home *** CD-ROM | disk | FTP | other *** search
/ CD Ware Multimedia 1995 May / cd Ware (Juegos) Epimundo.iso / DOS / C / MULT_FP.ZIP / MFPDOC-@.COM / MFPSHARE.DOC < prev   
Encoding:
Text File  |  1991-02-09  |  122.2 KB  |  4,133 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.                                   M F P 1
  19.  
  20.  
  21.                           A Multiple Field Processor
  22.  
  23.                                     and
  24.  
  25.                                Related Tools
  26.  
  27.                                   for the
  28.  
  29.                             Professional Developer
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.             Copyright 1990 by Jerome G. Kahn, All rights reserved
  54.        Produced Exclusively for Pride Software Advancement Corporation
  55.               3575 N.W. 31 Avenue Oakland Park, Florida 33309
  56.  
  57.        * Turbo C is a registered trademark of Borland International.
  58.        * Lattice is a registered trademark of Lattice Inc.
  59.        * Microsoft is a registered trademark of Microsoft Corporation.
  60.  
  61.                                     M F P 1
  62.           
  63.                                TABLE OF CONTENTS
  64.           
  65.           
  66.              PAGE                      DESCRIPTION
  67.           
  68.                4               MFP1 License Statement
  69.           
  70.                5               Installation
  71.           
  72.              Data Entry and User Input Functions
  73.  
  74.                7               Function:  MFP
  75.           
  76.                8                 MFP Field Definition
  77.           
  78.                9                 MFP List
  79.           
  80.               10 -  11           MFP Data Entry Picture Formatting
  81.           
  82.               12                 MFP Field Editing Keys
  83.           
  84.               13                 MFP Pre and Post Validation
  85.           
  86.               14                 MFP Procedure List
  87.           
  88.               15 - 19            MFP Example Listing
  89.           
  90.               20 - 24            MFP Example Listing Narrative
  91.           
  92.               25                 MFP Run Time Error Messages
  93.  
  94.               26               Function:  MENU
  95.           
  96.               27                 MENU Item Definition
  97.           
  98.                                  MENU List
  99.           
  100.                                  MENU Color
  101.           
  102.               28                 MENU Help Text
  103.           
  104.               29                 MENU Example
  105.           
  106.               30               Function:  PIC
  107.           
  108.               31               Function:  SCRN
  109.           
  110.               32               Function:  INKEY
  111.           
  112.               33                 INKEY Keyboard Usage
  113.           
  114.               34                 INKEY Definitions
  115.           
  116.               35               Function:  GETKEY
  117.           
  118.               36               Function:  FLUSH
  119.           
  120.           
  121.                                    M F P 1
  122.           
  123.                                TABLE OF CONTENTS
  124.           
  125.                                     PAGE 2
  126.           
  127.           
  128.              PAGE                      DESCRIPTION
  129.           
  130.              Data Entry and User Input Functions (continued)
  131.  
  132.               37               Function:  PAUSE
  133.           
  134.               38               Function:  FAST
  135.           
  136.              Screen Output Functions
  137.  
  138.               40               Function:  COLOR
  139.           
  140.               41               Function:  CUP
  141.           
  142.               42               Function:  GETCUP
  143.  
  144.               43               Function:  PRINT
  145.           
  146.               44               Function:  SAY
  147.           
  148.               45               Function:  BIOPUTC
  149.           
  150.               46               Function:  ESHOW
  151.           
  152.              Window Functions
  153.  
  154.               48               Function:  WINDOW_CREATE
  155.  
  156.               49               Function:  WINDOW_KILL
  157.  
  158.               50               Function:  WCLS
  159.           
  160.               51               Function:  BOX
  161.           
  162.               52               Function:  W_SWAP
  163.           
  164.               53               Function:  SCRSWP
  165.  
  166.              Buffer Manipulation Functions
  167.  
  168.               55               Function:  ZERO
  169.           
  170.               56               Function:  FILL
  171.           
  172.               57               Function:  CRC & CRC32
  173.           
  174.              Date and Time Functions
  175.  
  176.               59               Function:  DATE
  177.           
  178.               60               Function:  LDATE
  179.           
  180.               61               Function:  STR_JUL
  181.           
  182.           
  183.                                    M F P 1
  184.           
  185.                                TABLE OF CONTENTS
  186.           
  187.                                     PAGE 3
  188.           
  189.           
  190.              PAGE                      DESCRIPTION
  191.           
  192.              Date and Time Functions (continued)
  193.  
  194.               62               Function:  JUL_STR
  195.           
  196.               63               Function:  CAL_JUL
  197.           
  198.               64               Function:  JUL_CAL
  199.           
  200.               65               Function:  STRTIME
  201.           
  202.               66               Function:  TIME_NUM
  203.           
  204.              Miscellaneuos Functions
  205.  
  206.               68               Function:  BRKOFF & BRKON
  207.           
  208.               70               Function:  SCRSAVE & NOSAVE
  209.           
  210.               71               Function:  SHOWCLOK & NOCLOK
  211.  
  212.               72               Function:  DELAY
  213.  
  214.                         MFP1 License Statement
  215.  
  216.       This software is protected by both United States copyright law and
  217.     international treaty provisions. You, as a professional developer, know
  218.     better than any others what that means. You don't want your software
  219.     proliferated by others without any remuneration for your efforts any more
  220.     than we do. We ask that you respect our rights and in return we will pro-
  221.     vide you the best support and products to make you more productive.
  222.  
  223.       This is a special shareware release of the complete MFP1 library.
  224.     You are required to register your copy with us at Pride if you wish to
  225.     distribute any software linked with the MFP1 library. You are NOT
  226.     authorized to remove or modify any copyright notices embedded in the
  227.     MFP1 library files and the resultant linkage.
  228.  
  229.       To register your copy you MUST supply us with your name, mailing
  230.     address, day-time phone number, your compiler type and version, and
  231.     a check or money order for $25.00. 
  232.  
  233.       Please send your registration information to:
  234.  
  235.                    Pride Software Advancement Corporation
  236.                           3575 N.W. 31st Avenue
  237.                           Oakland Park, Florida
  238.                                  33309
  239.  
  240.       Your check or money order must be made payable to Pride Software
  241.     Advancement Corporation.
  242.  
  243.       You may consider yourself licensed on the date you register this
  244.     copy. 
  245.  
  246.       Source code is available directly from Pride for $159.00 plus 6% tax.
  247.     Include payment along with your registration if you want source and book.
  248.  
  249.       Software that you write and compile using the MFP1 library may be
  250.     sold or given away without any additional license or fees.
  251.  
  252.                                LIMITED WARRANTY
  253.  
  254.       We at Pride have made every effort to provide you with a bug-free and
  255.     well designed product. All features have been extensively tested.
  256.     We feel we are providing you with a mature and stable product. Nonetheless,
  257.     we cannot be held liable for any loss of profit or any other commercial
  258.     damage, including but not limited to, special; incidental; consequential;
  259.     or other damages. You, as the developer, are the ultimate responsibilty for
  260.     the integrity of your product.
  261.  
  262.       In the event that you discover a bug in the MFP1 library, you are re-
  263.     quested to contact our programming staff at (305)731-1085. They shall
  264.     make every effort to resolve your particular problem.
  265.  
  266.                                GOVERNING LAW
  267.  
  268.       This statement shall be governed, interpreted, and construed by the laws
  269.     of the State of Florida.
  270.  
  271.                                 INSTALLATION
  272.  
  273.       Installation is fairly straightforward, each library disk contains
  274.     all the libraries and header files for that type compiler. Each library
  275.     is named with its memory model as its suffix. There is only one header
  276.     file beacuse it is not memory model dependent.
  277.  
  278.       The mfp.h header file should be copied into the directory where your
  279.     other header files are stored.
  280.  
  281.       The MFPX.LIB files should be copied into the directory where you have
  282.     your other library files stored.
  283.  
  284.       These are the only files you need to use MFP1. The other diskettes
  285.     contain the source and object files necesarry to modify MFP1.
  286.  
  287.                     Model   Turbo C     Lattice     Microsoft
  288.                     -----   -------     -------     ---------
  289.                     Tiny        T       N/A         T
  290.                     Small       S       S           S
  291.                     Compact     C       P           C
  292.                     Medium      M       D           M
  293.                     Large       L       L           L
  294.                     Huge        H       N/A         H
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.                        DATA ENTRY AND USER INPUT FUNCTIONS
  322.  
  323. ===============================================================================
  324.  
  325. MFP
  326.  
  327. ===============================================================================
  328.  
  329. Function            Multiple Field Processor.
  330.  
  331. Syntax              void mfp( MFP *list, [ PROC *p_list ]|[ 0 ] );
  332.  
  333. Prototype in        mfp.h
  334.  
  335. Remarks             MFP scans the provided edit list to process a data
  336.                     entry session. The order in which the list is layed
  337.                     out is the order of field sequencing. Each field is
  338.                     entered and processed individually so any combination
  339.                     of character and numeric fields are permitted. Pre
  340.                     and post field validation is possible by providing
  341.                     the address of pre and post functions when defining
  342.                     an entry field.
  343.  
  344.                     The pre and post validation functions can perform any
  345.                     task the programmer wishes. Pre and post validation tasks
  346.                     have access to all the variables concerning the data, its
  347.                     location, picture, and color.
  348.  
  349.                     Character fields can be formatted by use of the picture
  350.                     formatting string. Numeric fields are defined in length,
  351.                     decimal places, and type using the same formatting struct-
  352.                     ure as printf(). 
  353.  
  354.                     An optional procedure list can be passed which defines
  355.                     any key or group of keys as "HOT KEYS" that can execute
  356.                     any function you desire. A PROC list is created by you
  357.                     that associates any key with any function.
  358.  
  359. NOTE:               Microsoft and Lattice C users, because MFP uses its own
  360.                     color driver instead of relying on the graphics library
  361.                     functions, to optimize performance and resultant code size,
  362.                     the color driver MUST be disabled before exiting to DOS.
  363.                     This is performed by calling color() and passing it minus
  364.                     one in the fg and bg parameters, color( -1,-1 ).
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.                                        7
  383.  
  384.                                                                         mfp
  385. MFP FIELD DEFINITION
  386.  
  387.     An MFP field is defined in the following manner:
  388.  
  389.     1)  A pointer to the data item.
  390.     2)  A pointer to the picture format string.
  391.     3)  The row and column of where the item will be on the screen.
  392.     4)  The foreground and background attributes of the input field.
  393.     5)  Optional pointers to the pre and post validation functions.
  394.         If pre and post validation is not used, a zero must be placed
  395.         in the pre and post validation positions.
  396.  
  397.     The following example will allow the entry of a three character string
  398.     converted to uppercase at row 5 column 15 with a black foreground and a
  399.     white background without pre or post validation. The field name is
  400.     "example_1" and will be referenced by that name in the MFP list.
  401.  
  402.            char buffer[ 4 ];
  403.            MFP example_1[] = { buffer, "!!!", 5, 15, BLACK, WHITE, 0, 0 };
  404.                   ^              ^       ^    ^   ^    ^      ^    ^  ^
  405. Field Name -------+              |       |    |   |    |      |    |  |
  406. Pointer to data variable --------+       |    |   |    |      |    |  |
  407. Picture formatting string ---------------+    |   |    |      |    |  |
  408. Row of field location ------------------------+   |    |      |    |  |
  409. Column of field location -------------------------+    |      |    |  |
  410. Foreground color of entry field -----------------------+      |    |  |
  411. Background color of entry field ------------------------------+    |  |
  412. Pre validation function pointer -----------------------------------+  |
  413. Post validation function pointer -------------------------------------+
  414.  
  415.     The following example will allow the entry of a five digit decimal integer
  416.     at row 10 column 15 with a blue foreground and a black background. Post
  417.     validation is performed but no pre validation.
  418.  
  419.     The field name is "example_2" and will be referenced by that name in the
  420.     MFP list.
  421.  
  422.        void post(void);
  423.        int idata;
  424.        MFP example_2[] = { &idata, "%5d", 10, 15, BLUE, BLACK, 0, post };
  425.  
  426.     The following example will allow the entry of a twelve digit double
  427.     precision floating point variable with nine digits left of
  428.     the decimal point and two digits to the right. Including the
  429.     decimal point, that makes up the field length of twelve. The
  430.     input field will be located at row 15 column 15 and have a
  431.     white foreground and blue background. Pre and post validation
  432.     is performed.
  433.  
  434.     The field name is "example_3" and will be referenced by that name in the
  435.     MFP list.
  436.  
  437.       void pre(void);
  438.       void post(void);
  439.       double fdata;
  440.       MFP example_3[] = { &fdata,  "%12.2lf", 15, 15, WHITE, BLUE, pre, post };
  441.  
  442.  
  443.                                        8
  444.  
  445.                                                                         mfp
  446. THE MFP LIST
  447.  
  448.     The MFP list array defines which fields are to be entered
  449.     and in what order. The fields in the MFP list must be defined.
  450.  
  451.     The MFP list is the first parameter that will be passed to the mfp()
  452.     function.
  453.  
  454.     The following example MFP list defines three fields to be inputted.
  455.     The three fields were described on the previous pages of this text.
  456.  
  457.         MFP *example[] = { example_1, example_2, example_3, 0 };
  458.  
  459.     The MFP list "example" will tell the mfp() function that fields
  460.     example_1, example_2, and example_3 are to be input and in the order
  461.     that they appear in the list. When the mfp() function has scanned
  462.     and processed all of the defined fields and has read in the zero
  463.     it will exit and return control to the calling program.
  464.  
  465.     NOTE: All MFP lists must be terminated with a zero to define the end
  466.           of the list.
  467.  
  468.  
  469.  
  470.  
  471.  
  472.  
  473.  
  474.  
  475.  
  476.  
  477.  
  478.  
  479.  
  480.  
  481.  
  482.  
  483.  
  484.  
  485.  
  486.  
  487.  
  488.  
  489.  
  490.  
  491.  
  492.  
  493.  
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.                                        9
  505.  
  506.                                                                         mfp
  507. DATA ENTRY PICTURE FORMATTING
  508.  
  509.       One of the main features that makes MFP stand out is it's
  510.       picture or data formatting capability. MFP uses a picture
  511.       string to identify the data type and it's characteristics.
  512.       Numeric variables are identified with a "%" percent symbol
  513.       as the first picture character. Any other symbol in the first
  514.       character position forces MFP to assume the data is a character
  515.       array. Numeric data is always entered as BASE 10 or decimal.
  516.  
  517.       Character entry is filtered by MFP to not allow control codes into
  518.       an entry field.
  519.  
  520.       Character formatting symbols are as follows:
  521.  
  522.         !                   Upper case conversion. ( alphanumeric )
  523.         *                   Security echo. All characters are allowed.
  524.         0 - 9               Numeric characters only, value limited by formatter
  525.         A, a                Alpha only allowed
  526.         H, h                Hexadecimal characters only
  527.         X, x                Any ASCII character
  528.         Y, y                Y or N only
  529.         All others          used as stationary objects
  530.  
  531.       Numeric formatting requirements are as follows:
  532.  
  533.         "%nn[.][nn]|[L][l][h]|[d][u][f]"
  534.  
  535.         *   The first character must be a percent symbol.
  536.         *   A length parameter must be provided. This will represent
  537.             the entire entry field length including decimal points and sign.
  538.         *   If a decimal point is provided a decimal length parameter is
  539.             required to indicate the number of decimal positions. A decimal
  540.             point cannot be used for non-floating point variables.
  541.  
  542.             NOTE: The length parameter must be at least three greater than
  543.                   the decimal length. ie; "%5.3f" would be illegal, yet "%5.2f"
  544.                   would be okay.
  545.  
  546.         *   Last is the variable type. MFP allows certain modifiers to the
  547.             standard variable types. The legal types  are as follows:
  548.  
  549.             hd  --  Short integer.
  550.             d   --  Signed integer.
  551.             ld  --  Signed long integer.
  552.             u   --  Unsigned integer.
  553.             lu  --  Unsigned long integer.
  554.             f   --  Single precision floating point.
  555.             lf  --  Double precision floating point.
  556.         *   Lf  --  Long double precision floating point.
  557.  
  558.         * Long double is not a standard variable type. Turbo C supports long
  559.           double along with a few other compilers. The other versions of this
  560.           library converts your long double to a double. If your compiler
  561.           supports long double, you may recompile the mfp.c file after changing
  562.           the define LONGDOUBLE to equate to TRUE. Then you may replace the MFP
  563.           object file in the library.
  564.  
  565.                                       10
  566.  
  567.                                                                         mfp
  568. DATA ENTRY PICTURE FORMATTING (cont'd)
  569.  
  570.         The following are examples of numeric data entry pictures and the
  571.         data they may represent:
  572.  
  573.             "%12.2lf"   --  999999999.99
  574.             "%5d"       --  32565
  575.             "%10lu"     --  9999999999
  576.             "%7.4f"     --  99.9999
  577.  
  578.         The following are examples of character data entry pictures and
  579.         the data they may represent:
  580.  
  581.             "(999)999-9999" --  Makes a good telephone field. The user can
  582.                                 only enter or position the cursor at the
  583.                                 non-stationary entry positions. The
  584.                                 parenthesis and dashes would be skipped
  585.                                 over allowing entry in only the proper
  586.                                 fields. The "9"s allow any number from zero
  587.                                 to nine to be entered.
  588.  
  589.             "!!!!!!!!!!"    --  Ten characters all uppercase. Make sure the
  590.                                 data item can hold ten characters plus a
  591.                                 terminating NULL.
  592.  
  593.             "999-99-9999"   --  Social security number entry field.
  594.  
  595.             "!!-999!!!!"    --  The first two characters will be uppercase
  596.                                 alphanumeric followed by a dash then three
  597.                                 numeric only characters followed
  598.                                 by four uppercase alphanumerics.
  599.  
  600.             "********"      --  Eight character password entry field, all
  601.                                 characters are allowed but only spaces are
  602.                                 displayed.
  603.  
  604.             "99AAA!!!!"     --  The first two characters are numeric the next
  605.                                 three are alpha and the last four are uppercase
  606.                                 alphnumeric.
  607.  
  608.             "Y"             --  This is a single character entry field for
  609.                                 a 'Y' or an 'N'. Input is converted to upper-
  610.                                 case.
  611.  
  612.             "19/39/99"      --  This is a character date entry field. The first
  613.                                 character can be a '1' or '0'. The second can
  614.                                 be any number, The third character is skipped
  615.                                 but is part of the input string. The fourth
  616.                                 character can be anything from '0' to '3'.
  617.  
  618.             "XXXXXXXX"      --  This is an eight character entry field. No
  619.                                 uppercase conversion is performed. What you
  620.                                 type is what you get.
  621.  
  622.  
  623.  
  624.  
  625.  
  626.                                       11
  627.  
  628.                                                                         mfp
  629. FIELD EDITING KEYS
  630.  
  631.  
  632.     Up Arrow    --  Moves cursor to first character of previous field.
  633.  
  634.                     If already at the first field, moves cursor to beginning
  635.                     of field.
  636.  
  637.     Down Arrow  --  Moves cursor to first character of next field.
  638.  
  639.                     If aleady at last field, exits the editing session and
  640.                     mfp() returns to calling routine.
  641.  
  642.     Left Arrow  --  Moves the cursor left to an input position in the
  643.                     current field.
  644.  
  645.                     Will jump over non-input positions defined in the
  646.                     field picture.
  647.  
  648.                     Has no effect if already at the first input character.
  649.  
  650.     Right Arrow --  Moves the cursor right to an input position in the
  651.                     current field.
  652.  
  653.                     Will jump over non-input positions defined in the
  654.                     field picture.
  655.  
  656.                     Has no effect if already at the last input position.
  657.  
  658.     Ctrl Right  --  Moves the cursor to the last input position in the
  659.                     current field.
  660.  
  661.     Ctrl Left   --  Moves the cursor to the first input position in the
  662.                     current field.
  663.  
  664.     Backspace   --  Move cursor to next left input position while deleting
  665.                     the contents of the input position. Destructive backspace.
  666.  
  667.     Home        --  Moves the cursor to the first input position of the first
  668.                     field.
  669.  
  670.     End         --  Ends the edit session. mfp() returns to the calling
  671.                     function.
  672.  
  673.     Insert      --  Puts mfp() into the insert mode allowing characters
  674.                     that are keyed to be inserted in front of characters
  675.                     that are positioned to the right. This key is a toggle
  676.                     which activates and deactivates the insert mode.
  677.  
  678.     Delete      --  Deletes the current character and shifts all characters
  679.                     to the right of the deleted character left once.
  680.  
  681. Ctrl Backspace  --  Deletes the entire entry field and positions cursor to
  682.                     the beginning of the field.
  683.  
  684.  
  685.  
  686.  
  687.                                      12
  688.  
  689.                                                                         mfp
  690. PRE AND POST VALIDATION
  691.  
  692.     1)  Cursor moves into field.
  693.     2)  Previous contents of field are displayed.
  694.     3)  Jump to line 6 if no pre-process.
  695.     4)  Procedure for pre-process is executed.
  696.     5)  Jump to line 10 if pre-process returned valid as a FALSE.
  697.     6)  User inputs data into field.
  698.     7)  Jump to line 10 if no post-process.
  699.     8)  Procedure for post-process is executed.
  700.     9)  Skip to line 6 if post-process returned valid as a FALSE.
  701.    10)  This field is finished, onto the next field...
  702.  
  703.     This describes the decisions mfp() makes when working a field. The
  704.     field processor provides the pre and post validation functions a variety
  705.     of data about the current field. Since the data is global, the pre and
  706.     post validation functions you write can have access to all data in
  707.     all fields allowing a great degree of flexibilty. The mfp() function
  708.     will allow you to perform any type of operation you choose, including
  709.     modifying the field you are entering or other fields.
  710.  
  711.     MFP provides the following list of global variables for your validation
  712.     functions to use:
  713.  
  714.   int mfp_valid     --  This variable is used to determine the outcome of your
  715.                         pre or post validation. If the validation fails this
  716.                         variable must be made FALSE. If your validation passes
  717.                         then make it TRUE.
  718.  
  719.   int mfp_field     --  This variable represents the current field number
  720.                         starting with zero.
  721.  
  722.   int mfp_update    --  This variable indicates if the fields contents have
  723.                         been changed. Non-zero if changed, zero if not changed.
  724.  
  725.   void *mfp_data    --  This variable is a pointer to the data item being
  726.                         entered. Your validation function may use this any
  727.                         way you see fit. You may change the data items value
  728.                         or read it directly by using it.
  729.  
  730.   char *mfp_picture --  This is a pointer to the picture formatting string
  731.                         for the field being entered. You may use it any
  732.                         way you see fit.
  733.  
  734.   int mfp_row       --  This variable provides your validation function with
  735.                         the screen row the entry field is on.
  736.  
  737.   int mfp_col       --  This variable provides your validation function with
  738.                         the screen column the entry field is on.
  739.  
  740.   int mfp_fg        --  This variable provides your validation function with
  741.                         the foreground color of the entry field.
  742.  
  743.   int mfp_bg        --  This variable provides your validation function with
  744.                         the background color of the entry field.
  745.  
  746.  
  747.  
  748.                                       13
  749.  
  750.                                                                         mfp
  751. THE PROCEDURE LIST
  752.  
  753.     The second parameter that can be passed to the MFP function is a
  754.     procedure list that sets up a relationship of keyboard keys to
  755.     functions.
  756.  
  757.     The procedure is called when the defined key is pressed. When the
  758.     procedure is finished MFP regains control from where it left off.
  759.  
  760.     The typedef PROC defines a structure that is used to define the
  761.     link between key and function. A PROC variable is defined and a
  762.     list of PROC variables is passed to the MFP function.
  763.  
  764.     The PROC variable needs the integer key value returned by inkey()
  765.     and a pointer to the function.
  766.  
  767.     Any key that the inkey() function can detect is legal for use
  768.     as a hot key.
  769.  
  770.     The following is an example of hot key definitions:
  771.  
  772.         void help( void );
  773.         void popup_1( void );
  774.         void popup_2( void );
  775.  
  776.         PROC  hotkey_1[] = { FN1, help };       /* F1 is for help       */
  777.         PROC  hotkey_2[] = { FN2, popup_1 };    /* F2 is a popup menu   */
  778.         PROC  hotkey_3[] = { FN3, popup_2 };    /* F3 is another popup  */
  779.  
  780.         PROC  *hotkeys[] = { hotkey_1, hotkey_2, hotkey_3, 0 };
  781.  
  782.     The PROC list "hotkeys" is an array of pointers to variables of type PROC.
  783.  
  784.     The order in which the hot keys are listed does not affect operation.
  785.  
  786.     The "hotkeys" variable would be passed as the second parameter in the
  787.     mfp() function call. Any time F1, F2, or F3 were pressed when mfp() was
  788.     executed the functions help(), popup_1(), or popup_2() would execute
  789.     then return control to mfp().
  790.  
  791.     NOTE: The PROC list, like the MFP list, must be terminated with a
  792.           zero.
  793.  
  794.  
  795.  
  796.  
  797.  
  798.  
  799.  
  800.  
  801.  
  802.  
  803.  
  804.  
  805.  
  806.  
  807.  
  808.  
  809.                                       14
  810.  
  811.  
  812. MFP EXAMPLE LISTING                                                     mfp
  813.  
  814.    1:  #include <stdio.h>
  815.    2:  #include <string.h>
  816.    3:  #include <dos.h>
  817.    4:  #include <conio.h>
  818.    5:  #include <ctype.h>
  819.    6:  #include <mfp.h>
  820.    7:  
  821.    8:  void drawscrn( char * );
  822.    9:  void prompts( void );
  823.   10:  void mess24( char *mess );
  824.   11:  void help( void );
  825.   12:  void inst( void );
  826.   13:  
  827.   14:  char                name[ 21 ];
  828.   15:  short int           binarys     = 0;
  829.   16:  int                 rel_lum     = 0;
  830.   17:  long int            sfc_temp    = 0L;
  831.   18:  unsigned int        abs_lum     = 0;
  832.   19:  unsigned long int   age_yrs     = 0L;
  833.   20:  float               magnitd     = 0.0;
  834.   21:  double              distance    = 0.0;
  835.   22:  long double         mass        = 0.0;
  836.   23:  
  837.   24:  MFP ln1[] = { name,"!!!!!!!!!!!!!!!!!!!!", 5,20,BLACK,WHITE,inst,0 };
  838.   25:  MFP ln2[] = { &binarys,  "%2hd",     7,20,BLACK,WHITE,inst,0 };
  839.   26:  MFP ln3[] = { &rel_lum,  "%6d",      9,20,BLACK,WHITE,inst,0 };
  840.   27:  MFP ln4[] = { &abs_lum,  "%6u",     11,20,BLACK,WHITE,inst,0 };
  841.   28:  MFP ln5[] = { &sfc_temp, "%9ld",    13,20,BLACK,WHITE,inst,0 };
  842.   29:  MFP ln6[] = { &age_yrs,  "%9lu",    15,20,BLACK,WHITE,inst,0 };
  843.   30:  MFP ln7[] = { &magnitd,  "%9.3f",   17,20,BLACK,WHITE,inst,0 };
  844.   31:  MFP ln8[] = { &distance, "%13.3lf", 19,20,BLACK,WHITE,inst,0 };
  845.   32:  MFP ln9[] = { &mass,     "%20.3Lf", 21,20,BLACK,WHITE,inst,0 };
  846.   33:  
  847.   34:  MFP *lst[] = { ln1, ln2, ln3, ln4, ln5, ln6, ln7, ln8, ln9, 0 };
  848.   35:  
  849.   36:  PROC p1[] = { FN1, help };
  850.   37:  PROC p2[] = { FN2, fast };
  851.   38:  
  852.   39:  PROC *plist[] = { p1, p2, 0 };
  853.   40:  
  854.   41:  void main()
  855.   42:  {
  856.   43:      int yorn;
  857.   44:      drawscrn("MFP Demonstration Program");
  858.   45:      prompts();
  859.   46:      do
  860.   47:      {
  861.   48:          mess24("Please enter above data...");
  862.   49:          ed_list = lst;
  863.   50:          mfp( lst, plist  );
  864.   51:          mess24("[ OPTIONS ]  <E>dit, <S>ave, or <A>bort  (E/S/A) ");
  865.   52:          do
  866.   53:          {
  867.   54:              yorn = inkey();
  868.   55:          }
  869.   56:          while( !yorn );
  870.                                       15
  871.  
  872.  
  873. MFP EXAMPLE LISTING (cont'd)                                            mfp
  874.  
  875.   57:          yorn = toupper( yorn );
  876.   58:          if( yorn == 'S' )
  877.   59:          {
  878.   60:              mess24("Saving data...");
  879.   61:          }
  880.   62:      }
  881.   63:      while( yorn == 'E' );
  882.   64:      color( WHITE, BLACK );
  883.   65:  }
  884.   66:  
  885.   67:  void drawscrn( char *header )
  886.   68:  {
  887.   69:      char buf[ 11 ];
  888.   70:      int x;
  889.   71:      color( WHITE, BLACK );
  890.   72:      clrscr();
  891.   73:      color( BLACK, WHITE );
  892.   74:      wcls( 1,1, 2,80 );
  893.   75:      color( WHITE, BLACK );
  894.   76:      for( x = 3 ; x < 25 ; x++ )
  895.   77:      {
  896.   78:          cup( x,1 );
  897.   79:          putch(186);
  898.   80:          cup( x,48 );
  899.   81:          putch(179);
  900.   82:          cup( x,80 );
  901.   83:          putch(186);
  902.   84:      }
  903.   85:      color( BLACK, WHITE );
  904.   86:      wcls( 24,1, 24,80 );
  905.   87:      cup( 1, 2 );
  906.   88:      print( ldate( buf ) );
  907.   89:      cup( 1,71 );
  908.   90:      print( strtime( buf ) );
  909.   91:      x = strlen( header );
  910.   92:      cup( 2, (80-x)/2 );
  911.   93:      print(header);
  912.   94:      color( WHITE, BLACK );
  913.   95:      wcls( 25,1, 25,80 );
  914.   96:      cup( 25,2 );
  915.   97:      print("F1 Help | F2 Jump | F3      | F4      | ");
  916.   98:      print("F5      | F6      | F7      | F8      ");
  917.   99:  }
  918.  100:  
  919.  101:  void prompts( void )
  920.  102:  {
  921.  103:      color( CYAN, BLACK );
  922.  104:      cup( 5,4 );
  923.  105:      print("Stellar Ident:");
  924.  106:      cup( 7,4 );
  925.  107:      print("  System Size:");
  926.  108:      cup( 9,4);
  927.  109:      print(" Relative Lux:");
  928.  110:      cup( 11,4 );
  929.  111:      print(" Absolute Lux:");
  930.  
  931.                                       16
  932.  
  933.  
  934. MFP EXAMPLE LISTING (cont'd)                                            mfp
  935.  
  936.  112:      cup( 13,4 );
  937.  113:      print(" Surface Temp:");
  938.  114:      cup( 15,4 );
  939.  115:      print("  Stellar Age:");
  940.  116:      cup( 17,4 );
  941.  117:      print("    Magnitude:");
  942.  118:      cup( 19,4 );
  943.  119:      print("  Light Years:");
  944.  120:      cup( 21,4 );
  945.  121:      print("         Mass:");
  946.  122:      color( WHITE, BLACK );
  947.  123:  }
  948.  124:  
  949.  125:  void mess24( char *mess )
  950.  126:  {
  951.  127:      color( BLACK, WHITE );
  952.  128:      wcls( 24,2,24,76 );
  953.  129:      cup( 24,2 );
  954.  130:      print( mess );
  955.  131:  }
  956.  132:  
  957.  133:  char *name_txt[] = {    "Please enter the name",
  958.  134:                          "of the stellar system.",
  959.  135:                          "",
  960.  136:                          "The name can be any",
  961.  137:                          "combination of letters",
  962.  138:                          "or numbers up to twenty",
  963.  139:                          "characters long.",
  964.  140:                          0
  965.  141:                      };
  966.  142:  char *size_txt[] =  {   "Please enter the number",
  967.  143:                          "of stellar mass bodies",
  968.  144:                          "in this system.",
  969.  145:                          "",
  970.  146:                          "A binary system would",
  971.  147:                          "have two stellar masses.",
  972.  148:                          "",
  973.  149:                          "A system like our sun's",
  974.  150:                          "would have only one.",
  975.  151:                          0
  976.  152:                      };
  977.  153:  char *lux_txt[] =   {   "Please enter the relative",
  978.  154:                          "intensity of the stellar",
  979.  155:                          "system in units of lux.",
  980.  156:                          "",
  981.  157:                          "This must be the relative",
  982.  158:                          "value not the absolute.",
  983.  159:                          "",
  984.  160:                          "This value may be positive",
  985.  161:                          "or negative with limits to",
  986.  162:                          "+/- 32000.",
  987.  163:                          "",
  988.  164:                          "It also must be a whole",
  989.  165:                          "number.",
  990.  166:                          0
  991.  167:                      };
  992.                                       17
  993.  
  994.  
  995. MFP EXAMPLE LISTING (cont'd)                                            mfp
  996.  
  997.  168:  char *alux_txt[] =  {   "Please enter the absolute",
  998.  169:                          "intensity of the stellar",
  999.  170:                          "system in units of lux.",
  1000.  171:                          "",
  1001.  172:                          "This must be the absolute",
  1002.  173:                          "value and not the relative.",
  1003.  174:                          "",
  1004.  175:                          "This value must be positive.",
  1005.  176:                          "Largest value cannot exceed",
  1006.  177:                          "65,535. It must also be a",
  1007.  178:                          "whole number.",
  1008.  179:                          0
  1009.  180:                      };
  1010.  181:  char *sftp_txt[] =  {   "Please enter the surface",
  1011.  182:                          "temparature in degrees",
  1012.  183:                          "Kelvin.",
  1013.  184:                          "",
  1014.  185:                          "The measured temparature",
  1015.  186:                          "must be in whole degrees",
  1016.  187:                          "and may be positive or",
  1017.  188:                          "negative.",
  1018.  189:                          "",
  1019.  190:                          "In the case of a multiple",
  1020.  191:                          "unit system, please enter",
  1021.  192:                          "the average temparature.",
  1022.  193:                          0
  1023.  194:                      };
  1024.  195:  char *age_txt[] =   {   "Please enter the age of",
  1025.  196:                          "the system in years.",
  1026.  197:                          "",
  1027.  198:                          "The age can be approximated",
  1028.  199:                          "by the apparent luminosity",
  1029.  200:                          "and the surface temp.",
  1030.  201:                          "",
  1031.  202:                          "The age cannot exceed 32",
  1032.  203:                          "billion years.",
  1033.  204:                          0
  1034.  205:                      };
  1035.  206:  char *magn_txt[] =  {   "Please enter the magnitude",
  1036.  207:                          "of the largest body in this",
  1037.  208:                          "system.",
  1038.  209:                          "",
  1039.  210:                          "The magnitude of this system",
  1040.  211:                          "can be entered as a floating",
  1041.  212:                          "point value.",
  1042.  213:                          0
  1043.  214:                      };
  1044.  215:  char *ltyr_txt[] =  {   "Please enter the distance",
  1045.  216:                          "from gravitaional center of",
  1046.  217:                          "our solar system to the",
  1047.  218:                          "gravitational center of",
  1048.  219:                          "this system.",
  1049.  220:                          "",
  1050.  
  1051.  
  1052.  
  1053.                                       18
  1054.  
  1055.  
  1056. MFP EXAMPLE LISTING (cont'd)                                            mfp
  1057.  
  1058.  221:                          "This value must be entered",
  1059.  222:                          "in light years. Fractional",
  1060.  223:                          "light years are permitted.",
  1061.  224:                          0
  1062.  225:                      };
  1063.  226:  char *mass_txt[] =  {   "Please enter the systems",
  1064.  227:                          "total mass in grams.",
  1065.  228:                          "",
  1066.  229:                          "This includes all masses",
  1067.  230:                          "that rotate around the",
  1068.  231:                          "center of mass of this",
  1069.  232:                          "system.",
  1070.  233:                          "",
  1071.  234:                          "Planetary bodies can be",
  1072.  235:                          "ommitted if no data is",
  1073.  236:                          "present.",
  1074.  237:                          0
  1075.  238:                      };
  1076.  239:  char **help_txt[] = {   name_txt,
  1077.  240:                          size_txt,
  1078.  241:                          lux_txt,
  1079.  242:                          alux_txt,
  1080.  243:                          sftp_txt,
  1081.  244:                          age_txt,
  1082.  245:                          magn_txt,
  1083.  246:                          ltyr_txt,
  1084.  247:                          mass_txt
  1085.  248:                      };
  1086.  249:  
  1087.  250:  void inst( void )
  1088.  251:  {
  1089.  252:      int x = 0;
  1090.  253:      color( WHITE, BLACK );
  1091.  254:      wcls( 5,50, 21,79 );
  1092.  255:      while( help_txt[ mfp_field ][ x ] )
  1093.  256:      {
  1094.  257:          cup( 7+x,50 );
  1095.  258:          print( help_txt[ mfp_field ][ x++ ] );
  1096.  259:      }
  1097.  260:  }
  1098.  261:  
  1099.  262:  void help( void )
  1100.  263:  {
  1101.  264:      char buf[ 4096 ];
  1102.  265:      scrswp( buf, 0 );
  1103.  266:      color( BLACK, WHITE );
  1104.  267:      wcls( 24,1,25,80 );
  1105.  268:      mess24("Your outta luck: no help available, press any key...");
  1106.  269:      pause();
  1107.  270:      scrswp( buf, 1 );
  1108.  271:  }
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.                                       19
  1115.  
  1116.  
  1117. MFP EXAMPLE LISTING NARRATIVE                                           mfp
  1118.  
  1119.  
  1120.  
  1121.  
  1122.     Lines 1 - 5:
  1123.  
  1124.       Includes for the prototypes and defines for the standard C functions
  1125.       used.
  1126.  
  1127.     Line 6:
  1128.  
  1129.       Include file needed to use MFP.
  1130.  
  1131.     Lines 8 - 12:
  1132.  
  1133.       Prototypes of the functions used in this example.
  1134.  
  1135.     Lines 14 - 22:
  1136.  
  1137.       Definition and intialization of variables to be used for data entry.
  1138.       This definition must preceed the MFP field definitions.
  1139.  
  1140.     Lines 24 - 32:
  1141.  
  1142.       An MFP entry field must be defined in this manner: MFP is a typedef
  1143.       and must preceed the MFP entry field variable, in this case the
  1144.       entry field variable would be ln1. The entry field variable must be
  1145.       an array defined with an open and close bracket. The entry field
  1146.       variable is initialized using the equal sign and enclosing the entry
  1147.       field parameters within braces. A semicolon must terminate each field
  1148.       definition.
  1149.  
  1150.     Line 24:
  1151.  
  1152.       Definition of a 20 character entry field for the name array. The entry
  1153.       data will be upper case and be positioned at row 5 column 20. It will
  1154.       have a black foreground and a white background. There is a prevalidation
  1155.       function called inst(). No post validation has been defined.
  1156.  
  1157.     Line 25:
  1158.  
  1159.       Definition of a 2 digit short integer entry field for the short integer
  1160.       binarys variable. Notice the ampersand, (&) preceeding the binarys
  1161.       variable name. This is absolutely neccessary because MFP needs a pointer
  1162.       to the data. This is not the case with character arrays because the name
  1163.       alone is the pointer. So all numeric variables must be preceeded with
  1164.       the ampersand in the MFP declaration. The picture uses the same format
  1165.       as printf(). This is the case for all numeric entry fields.
  1166.  
  1167.     Lines 26 - 32:
  1168.  
  1169.       Differ in the variable type and entry field size. These examples 
  1170.       represent all the variable types MFP can deal with. The entry field 
  1171.       length, decimal points, screen position and color are defined by you.
  1172.  
  1173.  
  1174.  
  1175.                                       20
  1176.  
  1177.  
  1178. MFP EXAMPLE LISTING NARRATIVE (cont'd)                                  mfp
  1179.  
  1180.  
  1181.     Line 34:
  1182.  
  1183.       Definition of the MFP list. The definition of this variable is
  1184.       straightforward enough. MFP needs a list of pointers to each entry
  1185.       field. The pointer to an entry field is its name without the array
  1186.       brackets. This variable happens to be called "lst". MFP will allow input
  1187.       into each field defined in "lst" and in the order that you put each entry
  1188.       field into lst. You can put whatever entry fields you want in whatever
  1189.       order you desire. The entry field must be defined prior to defining the
  1190.       list.
  1191.  
  1192.              -- All MFP lists must be terminated with a zero --
  1193.  
  1194.       All entry fields must be seperated by commas inside the MFP list.
  1195.       The list variable must be defined as an array of pointers to variables
  1196.       of type MFP. That is why lst is prefixed by an asterick and suffixed
  1197.       by an open and close bracket. This list variable called lst will be
  1198.       passed to MFP as it's first parameter.
  1199.  
  1200.     Line 36:
  1201.  
  1202.       Definition of a HOT key procedure. PROC is a typedef needed to define
  1203.       a procedure variable, in this case p1. The PROC variable must be
  1204.       declared as an array with an open and close bracket. The PROC variable
  1205.       is initialized using the same technique as MFP. The first parameter
  1206.       must be the keyboard key that will activate this PROC.
  1207.  
  1208.       Many of the keyboard keys have been defined for clarity. Any key that
  1209.       the inkey() function can sense is legal for a PROC. The inkey() function
  1210.       is used by MFP for all keyboard I/O this is why the PROC must use the
  1211.       value of the key returned by inkey(). In this example the FN1 definition
  1212.       evaluates to Function key 1 or "F1".
  1213.  
  1214.       The second parameter seperated by a comma is a pointer to the function
  1215.       that will execute when the key is pressed. A pointer to any function
  1216.       is its name without the open and close parenthesis. In this example
  1217.       a pointer to the function help() is used. The function must have been
  1218.       previously prototyped. In this example help() was prototyped in line 11.
  1219.  
  1220.     Line 37:
  1221.  
  1222.       HOT key PROC definition that sets up function key 2 to execute a
  1223.       function called fast(). The function fast() is a special function
  1224.       defined and programmed in the MFP library. It is prototyped in the mfp.h
  1225.       header. The fast() function places numbers in each entry field and
  1226.       prompts the user for which entry field they want to edit. When the user
  1227.       keys in the field number they are positioned into that field and are
  1228.       allowed to edit the data in that field. When they are finished editing,
  1229.       the fast() function terminates and the user is positioned back to the
  1230.       field they were previously editing. We suggest that you incorporate this
  1231.       feature into your applications - especially in screens with a large
  1232.       number of entry fields. If a user makes a mistake in a previous field or
  1233.       just wants to change one field's contents, the fast() function will be
  1234.       easier than moving up or down to the field to be changed.
  1235.  
  1236.                                       21
  1237.  
  1238.  
  1239. MFP EXAMPLE LISTING NARRATIVE (cont'd)                                  mfp
  1240.  
  1241.  
  1242.  
  1243.  
  1244.       These HOT key PROC's only execute when mfp(), menu(), or scrn() are
  1245.       active. This should present little-to-no difficulty since most of the
  1246.       time your programs will be executing these functions awaiting user input.
  1247.  
  1248.     Line 39:
  1249.  
  1250.       Definition of the PROC list needed by MFP. This list which is called
  1251.       plist must be passed as the second parameter to MFP or scrn(). The PROC
  1252.       list must be defined in the same manner as the MFP list. It also must
  1253.       be terminated with a zero, to define the end of the list.
  1254.  
  1255.     Line 44:
  1256.  
  1257.       Calls the function to draw the screen and the screen header is passed 
  1258.       as it's parameter.
  1259.  
  1260.     Line 45:
  1261.  
  1262.       Calls the function that displays the field prompts.
  1263.  
  1264.     Line 48:
  1265.  
  1266.       Calls the function to display the passed text on row 24.
  1267.  
  1268.     Line 49:
  1269.  
  1270.       Defines a global variable called "ed_list" to point to the MFP list,
  1271.       lst. The ed_list variable is the same variable type as the MFP list
  1272.       except it is used for the fast() function. If you are going to use the
  1273.       fast() function and you are including it into your PROC list you must
  1274.       define the ed_list variable. Most of the time you will define it as the
  1275.       same list as your MFP list. Sometimes you may want to define it as ano-
  1276.       ther list, to exclude or include other fields that are, or are not, acc-
  1277.       essable otherwise. The ed_list variable is initialized in the MFP library
  1278.       as pointing to nothing or NULL. If you find that the fast() function is
  1279.       doing nothing, check your ed_list definition. It must be defined before
  1280.       calling mfp().
  1281.  
  1282.     Line 50:
  1283.  
  1284.       This is the magic moment, here we call MFP. The parameters are lst
  1285.       and plist. By now we know what these parameters are and how they are
  1286.       defined. At this time the fields are displayed and the user is capable
  1287.       of performing data entry. When the user exits the last field or ends
  1288.       the edit session, mfp() returns.
  1289.  
  1290.     Line 51:
  1291.  
  1292.       Display to the user the available options on row 24.
  1293.  
  1294.  
  1295.  
  1296.  
  1297.                                       22
  1298.  
  1299.  
  1300. MFP EXAMPLE LISTING NARRATIVE (cont'd)                                  mfp
  1301.  
  1302.  
  1303.  
  1304.     Lines 52 - 56:
  1305.  
  1306.       Await a response from the user. The inkey() function operates exactly
  1307.       like BASIC's INKEY statement. It tests the keyboard buffer for a charac-
  1308.       ter, if none exists it returns with a NULL. Otherwise, it returns with
  1309.       an integer value representing the key pressed. So we wait as long as no
  1310.       key is pressed.
  1311.  
  1312.     Line 57:
  1313.  
  1314.       Converts the key to it's uppercase equivalent.
  1315.  
  1316.     Lines 58 - 63:
  1317.  
  1318.       Determine the course of action to be taken based upon the key pressed.
  1319.       If the user responds by pressing the 'e' or 'E' key the user will be
  1320.       looped back into another edit session.
  1321.  
  1322.     Line 64:
  1323.  
  1324.       Sets the color to a white foreground and a black background in prepar-
  1325.       ation of exiting to DOS.
  1326.  
  1327.     Line 67:
  1328.  
  1329.       This is the function header for a draw screen function. The parameter
  1330.       header is used for the screen header.
  1331.  
  1332.     Line 72:
  1333.  
  1334.       Calls the clear screen function clrscr().
  1335.  
  1336.     Line 74:
  1337.  
  1338.       Calls the window or block clear screen. The function wcls() will clear
  1339.       a rectangular area of screen defined by upper left and lower right co-
  1340.       ordinates.
  1341.  
  1342.     Lines 76 - 85:
  1343.  
  1344.       Draws three vertical lines. The cup() function is used for <CU>rsor
  1345.       <P>ositioning. The row parameter is first followed by the column. The
  1346.       top left position would be cup( 1,1 ).
  1347.  
  1348.     Line 88:
  1349.  
  1350.       Displays the date in the upper left of the screen. The ldate() function
  1351.       is used which returns a pointer to the character array supplied. This 
  1352.       array is stuffed with the current date retrieved from DOS.
  1353.  
  1354.     Line 90:
  1355.  
  1356.       Displays the time in the same manner as the date was displayed.
  1357.  
  1358.                                       23
  1359.  
  1360.  
  1361. MFP EXAMPLE LISTING NARRATIVE (cont'd)                                  mfp
  1362.  
  1363.  
  1364.  
  1365.     Lines 100 - 123:
  1366.  
  1367.       This is the function that displays the prompts on the screen.
  1368.  
  1369.     Lines 125 - 131:
  1370.  
  1371.       Displays a message of text on row 24 of the screen.
  1372.  
  1373.     Lines 133 - 238:
  1374.  
  1375.       These are the help text strings, defined as an array of pointers for
  1376.       each field.
  1377.  
  1378.     Lines 239 - 248:
  1379.  
  1380.       Defines a single variable as a pointer to an array of pointers. The 
  1381.       pointers are the help text. This simplifies coding of the online context
  1382.       sensitive help demonstrated here.
  1383.  
  1384.     Line 250:
  1385.  
  1386.       This is the function header for the inst() function that is the common
  1387.       prevalidation function used in all the entry fields.
  1388.  
  1389.     Line 252:
  1390.  
  1391.       Initializes and defines variable 'x'. This variable will be used to
  1392.       index through the lines of help text.
  1393.  
  1394.     Line 254:
  1395.  
  1396.       This clears the area of the screen right of the entry fields reserved
  1397.       for the help text.
  1398.  
  1399.     line 255:
  1400.  
  1401.       Determines if there is another line of text to be displayed for this
  1402.       field. It treats the help_txt variable as a two dimensional array. When
  1403.       the array points to a zero value it indicates that we are at the end of
  1404.       the help text for this field. The first array dimension is indexed by
  1405.       the mfp_field variable which indicates what field number we are at any
  1406.       given point. The second dimension indexes which line of text is being
  1407.       referenced.
  1408.  
  1409.     Line 258:
  1410.  
  1411.       Displays the line of text pointed to by the two dimensional pointer,
  1412.       help_txt. The 'x' indexer is post incremented to point to the next line.
  1413.  
  1414.     Lines 255 - 258:
  1415.  
  1416.       Loop until a zero value is resolved. This zero is stored at the end of
  1417.       each field help string set.
  1418.  
  1419.                                       24
  1420.  
  1421.  
  1422. MFP RUN TIME ERROR MESSAGES
  1423.  
  1424.     MFP generates very few run time messages, mostly because of its
  1425.     structure. The error checking that MFP does perform is mostly limited
  1426.     to the mfp() function itself and primarily only to picture formatting
  1427.     and input field declaration. MFP will not generate field overflow or
  1428.     other like messages - it is only concerned about your definitions, which
  1429.     are hard-coded by you. Unless you write self-modifying code, you should
  1430.     not expect messages from MFP. If you do get messages from MFP and you
  1431.     know that your declarations are correct, be on the lookout for ill-
  1432.     behaved memory usage. For instance, when you clear an array's contents
  1433.     make sure you are remaining within its boundries, if you go beyond, you
  1434.     will be destroying possible string space or even worse, the program itself.
  1435.  
  1436. *ERROR* Picture Format Invalid ->  <your format here>
  1437.  
  1438.         This error is generated when mfp is extracting the variable type
  1439.         out of your picture string. No match was found for the nine data
  1440.         types that mfp supports. Mfp expects the following data types and
  1441.         cannot understand any others - also watch out for upper and lower
  1442.         case. Any picture format that begins with a "%" symbol is assumed
  1443.         by mfp() to be a numeric and will be type checked as one and must
  1444.         have the following type identifiers at the end of the picture
  1445.         string : "ld","hd","d","lu","u","Lf","lf","f". If your picture
  1446.         string begins without the "%" symbol, mfp() will assume that the
  1447.         entry is a character string or array.
  1448.  
  1449. *ERROR* Missing format length ->  <your format here>
  1450.  
  1451.         This error is generated when mfp is setting up the input field
  1452.         length. This error occurs only on numeric entry fields. If you
  1453.         neglected to pass a length modifier in your picture format, you
  1454.         can expect to see this error message. Numeric entry picture strings
  1455.         MUST have a length modifier so mfp() can build an entry field of
  1456.         that size for your user to input the data. The mfp() function makes
  1457.         no assumptions about field length for any numeric type. A properly
  1458.         declared picture for a five digit unsigned long integer would look
  1459.         like "%5lu". Mfp uses the '5' to build an entry field five characters
  1460.         in length.
  1461.  
  1462. *ERROR* Length too short ->  <your format here>
  1463.  
  1464.         This error occurs only on floating point numeric entry with a
  1465.         decimal point involved in the picture. When mfp() gets the field
  1466.         length and the number of digits to the right of the decimal point,
  1467.         it checks to see if you have given enough room in the field length
  1468.         for the sign, decimal point itself, and one digit to the left. This
  1469.         means that mfp() needs at least a field length of three digits more
  1470.         than the number of digits to the right of the decimal. For example
  1471.         if you wanted to define a field for the entry of a floating point
  1472.         number that had four decimal digits to the right of the decimal,
  1473.         the minimum field length would be seven digits, "%7.4f". If you
  1474.         were to define a field as, "%10.8lf", mfp() would give you this
  1475.         error message because it couldn't build the field in ten digits and
  1476.         work properly. The proper definition would be, "%11.8lf" or "%10.7lf".
  1477.         The above examples are only minimums, you may exceed the minimums as
  1478.         your application demands, ie; "%12.2lf","%10.2Lf","%4.0f","%5f"...
  1479.  
  1480.                                       25
  1481.  
  1482. ===============================================================================
  1483.  
  1484. MENU
  1485.  
  1486. ===============================================================================
  1487.  
  1488. Function        User menu function with HOT key support.
  1489.  
  1490. Syntax          int menu( MENU **menulist, PROC **proclist )
  1491.  
  1492. Prototype in    mfp.h
  1493.  
  1494. Remarks         Returns an integer value representing the menu option selected.
  1495.                 The return value would be from zero to N - 1. If the user
  1496.                 presses the escape key, a value of -1 is returned.
  1497.  
  1498.                 The menu() function presents to the user your menu and the help
  1499.                 text if provided. The user knows which menu option he is at
  1500.                 by menu() highlighting the current option. The user navigates
  1501.                 through the menu list via the standard cursor keys. The user
  1502.                 may also select an option by pressing the appropriate key, 
  1503.                 this immediatly selects the option with one keypress. The user
  1504.                 may also press the escape key and menu() will return with a -1.
  1505.                 When the user cursors over to the wanted selection, he must
  1506.                 press enter to validate the selection and menu() returns with
  1507.                 the integer value of his selection.
  1508.  
  1509.                 The menu() function also supports HOT key PROC's. You must
  1510.                 provide a PROC list, exactly as in mfp(). If the user presses
  1511.                 a PROC key, the menu() function will execute the PROC and
  1512.                 return back to the menu when completed.
  1513.  
  1514.                 The menu() function requires a MENU list. This list is a
  1515.                 group of menu items in the order of value you want returned.
  1516.                 The first item of a menu list, if selected, will have a value
  1517.                 of zero; the second item will have a value of one; and so-on
  1518.                 for the rest. The MENU list MUST be terminated with a zero to
  1519.                 identify the end of the list.
  1520.  
  1521.                 The menu() function can accept a PROC list for HOT key PROC
  1522.                 capability. If you don't wan't PROC key support you must
  1523.                 pass a zero as the PROC parameter.
  1524.  
  1525.  
  1526.  
  1527.  
  1528.  
  1529.  
  1530.  
  1531.  
  1532.  
  1533.  
  1534.  
  1535.  
  1536.  
  1537.  
  1538.  
  1539.  
  1540.  
  1541.                                       26
  1542.  
  1543.                                                                         menu
  1544.  
  1545.     MENU ITEM DEFINITION:
  1546.  
  1547.                 Each menu item is defined using the typedef MENU. This
  1548.                 simplifies your coding and makes defining a menu a snap.
  1549.  
  1550.                 An example menu item is defined as follows:
  1551.  
  1552.                 MENU item1[] = { 10, 20, "Edit", 'E', "Edit the above data." };
  1553.  
  1554.                 The typedef MENU is followed by an item name which must be
  1555.                 unique. The item must be declared as an array. The array is
  1556.                 to be defined by direct assignment using the equals symbol
  1557.                 followed by an open brace.
  1558.  
  1559.                 The first parameters in the braces are the row and column
  1560.                 respectively. This is the row and column where this item will
  1561.                 appear on the screen.
  1562.  
  1563.                 The next parameter is the item text that will be displayed.
  1564.  
  1565.                 Following the item text is the alternate keyboard key that
  1566.                 can also be used to select this item. If this key is pressed,
  1567.                 this item will be selected and menu() will return with this
  1568.                 menu item's value. This parameter MUST be uppercase, because
  1569.                 the keyboard input will be converted to uppercase for testing.
  1570.  
  1571.                 Last but not least, is the optional help text that will be
  1572.                 displayed when this menu item is highlighted. If you do not
  1573.                 want any help text to be displayed, you must place a zero in
  1574.                 this parameter.
  1575.  
  1576.                 Finally the menu declaration must be terminated with a close
  1577.                 brace and a semicolon.
  1578.  
  1579.     THE MENU LIST:
  1580.  
  1581.                 The menu list directs menu() to show the menu items in the
  1582.                 order you established in the list, the return value starting
  1583.                 from zero indicates the selection the user made, the first item
  1584.                 in the menu list being zero and the last; N - 1. The menu list
  1585.                 MUST be terminated with a zero. The menu list must be declared
  1586.                 with the typedef MENU as an array of pointers.
  1587.  
  1588.                 MENU *menulist[] = { item1, item2, item3, 0 };
  1589.  
  1590.     THE MENU COLOR:
  1591.  
  1592.                 The menu function defaults to a white on black menu with
  1593.                 the highlighted selection being black on white. This can
  1594.                 be altered by changing the value of the following global
  1595.                 variables that menu() uses:
  1596.  
  1597.                     MENNORMFG   This is the normal menu foreground attribute.
  1598.                     MENNORMBG   This is the normal menu background attribute.
  1599.                     MENLITEFG   This is the highlighted foreground attribute.
  1600.                     MENLITEBG   This is the highlighted background attribute.
  1601.  
  1602.                                       27
  1603.  
  1604.                                                                         menu
  1605.     THE HELP TEXT:
  1606.  
  1607.                 The help text parameter is displayed when the user
  1608.                 navigates to a menu item that has a help text line
  1609.                 declared other than a zero. This text must not go beyond
  1610.                 the 80th column. The help text line is cleared before
  1611.                 the text is displayed so shorter lines won't appear with
  1612.                 the remnents of a previous longer line.
  1613.  
  1614.                 The help text is defaulted to be displayed on row 25
  1615.                 column 1 with a WHITE on BLACK attribute with a maximum
  1616.                 text length of 80 characters.
  1617.  
  1618.                 The help text position and attributes can be changed by
  1619.                 modifying the contents of the following global variables:
  1620.  
  1621.                     MENHLPROW   This is a global integer that is used for
  1622.                                 the row position of the menu help text.
  1623.  
  1624.                     MENHLPCOL   This global integer is used for the column
  1625.                                 position of the menu help text.
  1626.  
  1627.                     MENHLPLEN   This global integer is used to determine
  1628.                                 the maximum length of the help text. This,
  1629.                                 plus the MENHLPCOL, cannot extend past column
  1630.                                 80 on the screen. MENHLPCOL + MENHLPLEN <= 80
  1631.  
  1632.                     MENHLPFG    This global integer is used for the foreground
  1633.                                 attribute of the help text color.
  1634.  
  1635.                     MENHLPBG    This global integer is used for the background
  1636.                                 attribute of the help text color.
  1637.  
  1638.                 The above variables are declared in the mfp library and
  1639.                 prototyped for you in mfp.h. To change one or more of the
  1640.                 the above items you only need to assign the value with an
  1641.                 assignment statement, ie;
  1642.                                             MENHLPROW = 2;
  1643.  
  1644.                 This assignment changed the help text row to row 2. Any
  1645.                 changes to these variables are global and remain until
  1646.                 changed again.
  1647.  
  1648.  
  1649.     MENU INITIAL POSITIONING:
  1650.  
  1651.                 The initial menu selection can be preset within the
  1652.                 range of menu options present.
  1653.  
  1654.                 MENSELPOS   --  This is the global menu initial position
  1655.                                 variable. It is normally set to (-1), this
  1656.                                 makes the menu start at the top item. Any
  1657.                                 other value of 0 to n-1 will highlite the
  1658.                                 appropriate selection.
  1659.  
  1660.                 The menu function does not modify the value of MENSELPOS.
  1661.                 MENSELPOS is a signed integer.
  1662.  
  1663.                                       28
  1664.  
  1665.                                                                         menu
  1666.  
  1667. EXAMPLE:
  1668.  
  1669.  
  1670.                 #include <stdio.h>
  1671.                 #include <mfp.h>
  1672.  
  1673.                 MENU item1[] = { 10,20, "1) Accounts receivable.", '1', 0 };
  1674.                 MENU item2[] = { 12,20, "2) Accounts payable....", '2', 0 };
  1675.                 MENU item3[] = { 14,20, "3) Payroll.............", '3', 0 };
  1676.                 MENU item4[] = { 16,20, "4) General ledger......", '4', 0 };
  1677.                 MENU item5[] = { 20,20, "Exit...................", 'Q', 
  1678.                                         "Exit this program to DOS..." };
  1679.  
  1680.                 MENU *mainmenu[] =  {
  1681.                                         item1, item2, item3, item4, item5, 0
  1682.                                     };
  1683.  
  1684.  
  1685.                 void main( void )
  1686.                 {
  1687.                     int menu_sel;
  1688.  
  1689.                     do
  1690.                     {
  1691.                         clrscr();
  1692.  
  1693.                         menu_sel = menu( mainmenu, 0 );
  1694.  
  1695.                         switch( menu_sel )
  1696.                         {
  1697.                             case 0:
  1698.                                     accrecv();
  1699.                                     break;
  1700.                             case 1:
  1701.                                     accpay();
  1702.                                     break;
  1703.                             case 2:
  1704.                                     payroll();
  1705.                                     break;
  1706.                             case 3:
  1707.                                     genldgr();
  1708.                                     break;
  1709.                             default:
  1710.                                     break;
  1711.                         }
  1712.  
  1713.                     } while( menu_sel != 4 && menu_sel != -1 );
  1714.  
  1715.                     return;
  1716.                 }
  1717.  
  1718.  
  1719.  
  1720.  
  1721.  
  1722.  
  1723.  
  1724.                                       29
  1725.  
  1726. ===============================================================================
  1727.  
  1728. PIC
  1729.  
  1730. ===============================================================================
  1731.  
  1732. Function        Single line character entry with picture formatting.
  1733.  
  1734. Syntax          char *pic( char *data, char *picture )
  1735.  
  1736. Prototype in    mfp.h
  1737.  
  1738. Remarks         
  1739.  
  1740.                 Pic() returns a pointer to the character string provided as
  1741.                 the data parameter. It acts as a replacement for gets(),
  1742.                 with all the line editing features of mfp(). A character
  1743.                 picture string is required. Pic() terminates when the user
  1744.                 presses the enter or escape key. Since the same keys are used
  1745.                 for editing as in mfp(), pic is an ideal choice for single
  1746.                 field entry.
  1747.  
  1748.                 The escape key clears the input field and pic terminates.
  1749.  
  1750.                 Pic() pads any trailing white space with NUL's upon termin-
  1751.                 ation.
  1752.  
  1753.                 The following is a list of picture characters:
  1754.  
  1755.                   Format Character    Purpose
  1756.  
  1757.                   !                   Upper case conversion ( allows numerics )
  1758.                   *                   Security echo. All characters are allowed.
  1759.                   0 - 9               Numeric only, largest value filtered
  1760.                   A, a                Alpha only allowed
  1761.                   H, h                Hexadecimal Only
  1762.                   X, x                Any ASCII character
  1763.                   Y, y                Yes or No only
  1764.                   All others          used as stationary objects
  1765.  
  1766. EXAMPLE:
  1767.                 #include <stdio.h>
  1768.                 #include <mfp.h>
  1769.  
  1770.                 char *picture = "999-99-9999";
  1771.                 char data[ 12 ];
  1772.  
  1773.                 void main( void )
  1774.                 {
  1775.                     zero( data, 12 );
  1776.                     clrscr();               /* Clear the screen */
  1777.                     cup( 10, 15 );
  1778.                     print("Please enter your social security number:");
  1779.                     pic( data, picture );
  1780.                 }
  1781.  
  1782.  
  1783.  
  1784.  
  1785.                                       30
  1786.  
  1787. ===============================================================================
  1788.  
  1789. SCRN
  1790.  
  1791. ===============================================================================
  1792.  
  1793. Function        Single line entry function with HOT key processing.
  1794.  
  1795. Syntax          int scrn( char *data, char *picture, PROC **proc_list )
  1796.  
  1797. Prototype in    mfp.h
  1798.  
  1799. Remarks         Scrn() is used in place of pic() when a single data item
  1800.                 is to be entered - be it one character or an entire line.
  1801.  
  1802.                 The major differences between scrn() and pic() are: pic()
  1803.                 returns a character pointer to the edited data item and
  1804.                 scrn() returns an integer representing the key press that
  1805.                 terminated the edit session. Also, scrn() allows a procedure
  1806.                 list as the third parameter for HOT key processing.
  1807.  
  1808.                 If HOT key processing is not required you may pass a zero
  1809.                 as the PROC parameter, otherwise  you should pass a procedure,
  1810.                 PROC list, exactly like that used in mfp().
  1811.  
  1812.                 To clarify scrn() further, it should be mentioned here
  1813.                 that scrn() is the actual editing function used by mfp().
  1814.  
  1815.                 Scrn() uses the same picture format as pic().
  1816.  
  1817.                 Scrn() terminates with the following key presses: enter, home,
  1818.                 end, up arrow, down arrow, and escape.
  1819.  
  1820.  
  1821.  
  1822.  
  1823.  
  1824.  
  1825.  
  1826.  
  1827.  
  1828.  
  1829.  
  1830.  
  1831.  
  1832.  
  1833.  
  1834.  
  1835.  
  1836.  
  1837.  
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843.  
  1844.  
  1845.  
  1846.                                       31
  1847.  
  1848. ===============================================================================
  1849.  
  1850. INKEY
  1851.  
  1852. ===============================================================================
  1853.  
  1854. Function        Keyboard input without wait or echo.
  1855.  
  1856. Syntax          int inkey( void );
  1857.  
  1858. Prototype in    mfp.h
  1859.  
  1860.  
  1861. Remarks         Same as BASIC's INKEY$ statement. When called, it
  1862.                 checks for the presence of a key press from the keyboard
  1863.                 buffer. Returns an integer value representing the key
  1864.                 pressed. Returns only one key press at a time. If
  1865.                 no key presses are in the buffer, it returns a zero.
  1866.                 Extended keys are returned with a 0x0F placed in the
  1867.                 upper 8 bits. This simplifies dealing with extended
  1868.                 scan codes from the keyboard.
  1869.  
  1870.  
  1871.  
  1872. EXAMPLE:
  1873.  
  1874.  
  1875.                 #include <stdio.h>
  1876.                 #include <mfp.h>
  1877.  
  1878.                 void main( void )
  1879.                 {
  1880.                     unsigned int x = 0;
  1881.  
  1882.                     while( x != 3  )
  1883.                     {
  1884.                         x = inkey();
  1885.  
  1886.                         if( x )
  1887.                             printf("%x\n",x);
  1888.                     }
  1889.                 }
  1890.  
  1891.  
  1892.  
  1893.  
  1894.  
  1895.  
  1896.  
  1897.  
  1898.  
  1899.  
  1900.  
  1901.  
  1902.  
  1903.  
  1904.  
  1905.  
  1906.  
  1907.                                       32
  1908.  
  1909.                                                                         inkey
  1910. KEYBOARD USAGE:
  1911.  
  1912.   Inkey returns the following hexadecimal integer for each key combination.
  1913.   Shift, Control, and Alternate combinations are designated as S, C, or A.
  1914.  
  1915.  
  1916.   Esc  F1  F2  F3  F4      F5  F6  F7  F8      F9 F10 F11 F12
  1917.  +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---------------+
  1918. N| 1B|F3B|F3C|F3D|F3E|   |F3F|F40|F41|F42|   |F43|F44|   |   |               |N
  1919. S| 1B|F54|F55|F56|F57|   |F58|F59|F5A|F5B|   |F5C|F5D|   |   |               |S
  1920. C| 1B|F5E|F5F|F60|F61|   |F62|F63|F64|F65|   |F66|F67|   |   |               |C
  1921. A|   |F68|F69|F6A|F6B|   |F6C|F6D|F6E|F6F|   |F70|F71|   |   |               |A
  1922.  +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---------------+
  1923.  
  1924.  
  1925.   ~/` !/1 @/2 #/3 $/4 %/5 ^/6 &/7 */8 (/9 )/0 _/- +/= BKS     INS HOM PUP
  1926.  +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
  1927. N| 60| 31| 32| 33| 34| 35| 36| 37| 38| 39| 30| 2D| 39|  8|   |F52|F47|F49|   |N
  1928. S| 7E| 21| 40| 23| 24| 25| 5E| 26| 2A| 28| 29| 5F| 2B|  8|   |F52|F47|F49|   |S
  1929. C|   |   |F03|   |   |   | 1E|   |   |   |   | 1F|   | 7F|   |   |F77|F84|   |C
  1930. A|   |F78|F79|F7A|F7B|F7C|F7D|F7E|F7F|F80|F81|F82|F83|   |   |   |   |   |   |A
  1931.  +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
  1932.  
  1933.  
  1934.   TAB  Q   W   E   R   T   Y   U   I   O   P  {/[ }/] |/\     DEL END PDN
  1935.  +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
  1936. N|  9| 71| 77| 65| 72| 74| 79| 75| 69| 6F| 70| 5B| 5D| 5C|   |F53|F4F|F51|   |N
  1937. S|F0F| 51| 57| 45| 52| 54| 59| 55| 49| 4F| 50| 7B| 7D| 7C|   |F53|F4F|F51|   |S
  1938. C|   | 11| 17|  5| 12| 14| 19| 15|  9|  F| 10| 1B| 1D| 1C|   |   |F75|F76|   |C
  1939. A|   |F10|F11|F12|F13|F14|F15|F16|F17|F18|F19|   |   |   |   |   |   |   |   |A
  1940.  +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
  1941.  
  1942.  
  1943.   CAP  A   S   D   F   G   H   J   K   L  :/; "/'  ENTER
  1944.  +---+---+---+---+---+---+---+---+---+---+---+---+-------+-------------------+
  1945. N|   | 61| 73| 64| 66| 67| 68| 6A| 6B| 6C| 3B| 27|   D   |                   |N
  1946. S|   | 41| 53| 44| 46| 47| 48| 4A| 4B| 4C| 3A| 22|   D   |                   |S
  1947. C|   |  1| 13|  4|  6|  7|  8|  A|  B|  C|   |   |   A   |                   |C
  1948. A|   |F1E|F1F|F20|F21|F22|F23|F24|F25|F26|   |   |       |                   |A
  1949.  +---+---+---+---+---+---+---+---+---+---+---+---+-------+-------------------+
  1950.  
  1951.  
  1952.    SHIFT   Z   X   C   V   B   N   M  </, >/. ?//  SHIFT           UP
  1953.  +-------+---+---+---+---+---+---+---+---+---+---+-------+-------+---+-------+
  1954. N|       | 7A| 78| 63| 76| 62| 6E| 6D| 2C| 2E| 2F|       |       |F48|       |N
  1955. S|       | 5A| 58| 43| 56| 42| 4E| 4D| 3C| 3E| 3F|       |       |F48|       |S
  1956. C|       | 1A| 18|  3| 16|  2|  E|  D|   |   |   |       |       |   |       |C
  1957. A|       |F2C|F2D|F2E|F2F|F30|F31|F32|   |   |   |       |       |   |       |A
  1958.  +-------+---+---+---+---+---+---+---+---+---+---+-------+-------+---+-------+
  1959.  
  1960.  
  1961.   CTL     ALT           SPACE BAR             ALT     CTL     LFT DWN RGT
  1962.  +---+---+---+-------------------------------+---+---+---+---+---+---+---+---+
  1963. N|   |   |   |             20                |   |   |   |   |F4B|F50|F4D|   |N
  1964. S|   |   |   |             20                |   |   |   |   |F4B|F50|F4D|   |S
  1965. C|   |   |   |             20                |   |   |   |   |F73|   |F74|   |C
  1966. A|   |   |   |             20                |   |   |   |   |   |   |   |   |A
  1967.  +---+---+---+-------------------------------+---+---+---+---+---+---+---+---+
  1968.                                       33
  1969.  
  1970.                                                                         inkey
  1971. DEFINITIONS FOR INKEY:
  1972.  
  1973.  The following is a list of definitions in mfp.h used for inkey(). Please feel
  1974.  free to use them in your programs to make your keyboard references clearer.
  1975.  
  1976.   FN1     Function key 1                UPARROW     Up arrow
  1977.   FN2     Function key 2                DNARROW     Down arrow
  1978.   FN3     Function key 3                LFARROW     Left arrow
  1979.   FN4     Function key 4                RTARROW     Right arrow
  1980.   FN5     Function key 5                C_LFARROW   Control left arrow
  1981.   FN6     Function key 6                C_RTARROW   Control right arrow
  1982.   FN7     Function key 7                INSERT      Insert key
  1983.   FN8     Function key 8                DELETE      Delete key
  1984.   FN9     Function key 9                HOME        Home key
  1985.   FN10    Function key 10               END         End key
  1986.   S_FN1   Shift function key 1          PAGEUP      Page up key
  1987.   S_FN2   Shift function key 2          PAGEDN      Page down key
  1988.   S_FN3   Shift function key 3          C_HOME      Control home
  1989.   S_FN4   Shift function key 4          C_END       Control end
  1990.   S_FN5   Shift function key 5          C_PAGEUP    Control page up
  1991.   S_FN6   Shift function key 6          C_PAGEDN    Control page down
  1992.   S_FN7   Shift function key 7          ESCAPE      Escape key
  1993.   S_FN8   Shift function key 8          BACKSPACE   Backspace key
  1994.   S_FN9   Shift function key 9          C_BACKSPACE Control backspace
  1995.   S_FN10  Shift function key 10         TAB         Tab key
  1996.   C_FN1   Control function key 1        S_TAB       Shift tab
  1997.   C_FN2   Control function key 2        ENTER       Enter key
  1998.   C_FN3   Control function key 3        C_ENTER     Control enter
  1999.   C_FN4   Control function key 4        C_MINUS     Control minus
  2000.   C_FN5   Control function key 5        A_MINUS     Alternate minus
  2001.   C_FN6   Control function key 6        A_EQUAL     Aternate equal
  2002.   C_FN7   Control function key 7        TRUE        Logical true (non zero)
  2003.   C_FN8   Control function key 8        FALSE       Logical false (zero)
  2004.   C_FN9   Control function key 9        CTL_2       Control two
  2005.   C_FN10  Control function key 10       CTL_6       Control six
  2006.   A_FN1   Alternate function key 1      ALT_0       Alternate zero
  2007.   A_FN2   Alternate function key 2      ALT_1       Alternate one
  2008.   A_FN3   Alternate function key 3      ALT_2       Alternate two
  2009.   A_FN4   Alternate function key 4      ALT_3       Alternate three
  2010.   A_FN5   Alternate function key 5      ALT_4       Alternate four
  2011.   A_FN6   Alternate function key 6      ALT_5       Alternate five
  2012.   A_FN7   Alternate function key 7      ALT_6       Alternate six
  2013.   A_FN8   Alternate function key 8      ALT_7       Alternate seven
  2014.   A_FN9   Alternate function key 9      ALT_8       Alternate eight
  2015.   A_FN10  Alternate function key 10     ALT_9       Alternate nine
  2016.  
  2017.         CTL_A       CTL_N       ALT_A       ALT_N       CTL_B
  2018.         CTL_O       ALT_B       ALT_O       CTL_C       CTL_P
  2019.         ALT_C       ALT_P       CTL_D       CTL_Q       ALT_D
  2020.         ALT_Q       CTL_E       CTL_R       ALT_E       ALT_R
  2021.         CTL_F       CTL_S       ALT_F       ALT_S       CTL_G
  2022.         CTL_T       ALT_G       ALT_T       CTL_H       CTL_U
  2023.         ALT_H       ALT_U       CTL_I       CTL_V       ALT_I
  2024.         ALT_V       CTL_J       CTL_W       ALT_J       ALT_W
  2025.         CTL_K       CTL_X       ALT_K       ALT_X       CTL_L
  2026.         CTL_Y       ALT_L       ALT_Y       CTL_M       CTL_Z
  2027.         ALT_M       ALT_Z
  2028.  
  2029.                                       34
  2030.  
  2031. ===============================================================================
  2032.  
  2033. GETKEY
  2034.  
  2035. ===============================================================================
  2036.  
  2037. Function        Single character input with echo.
  2038.  
  2039. Syntax          char getkey( void );
  2040.  
  2041. Prototype in    mfp.h
  2042.  
  2043.  
  2044. Remarks         Allows a single character to be inputted. All characters
  2045.                 are converted to upper case.
  2046.  
  2047.  
  2048. EXAMPLE:
  2049.  
  2050.  
  2051.                 #include <stdio.h>
  2052.                 #include <mfp.h>
  2053.  
  2054.                 void main( void )
  2055.                 {
  2056.                     char c = '\0';
  2057.  
  2058.                     while( c != 'A'  )
  2059.                     {
  2060.                         c = getkey();
  2061.                     }
  2062.                 }
  2063.  
  2064.  
  2065.  
  2066.  
  2067.  
  2068.  
  2069.  
  2070.  
  2071.  
  2072.  
  2073.  
  2074.  
  2075.  
  2076.  
  2077.  
  2078.  
  2079.  
  2080.  
  2081.  
  2082.  
  2083.  
  2084.  
  2085.  
  2086.  
  2087.  
  2088.  
  2089.  
  2090.                                       35
  2091.  
  2092. ===============================================================================
  2093.  
  2094. FLUSH
  2095.  
  2096. ===============================================================================
  2097.  
  2098. Function        To flush any characters in the keyboard buffer.
  2099.  
  2100. Syntax          void flush( void )
  2101.  
  2102. Prototype in    mfp.h
  2103.  
  2104. Remarks         Clears the typeahead of the keyboard. Handy before using
  2105.                 the inkey() function. Assures that the next key pressed did
  2106.                 not occur before you expected.
  2107.  
  2108. EXAMPLE:
  2109.  
  2110.                 #include <stdio.h>
  2111.                 #include <mfp.h>
  2112.  
  2113.                 void wait_usr( void )
  2114.                 {
  2115.                     cup( 24,2 );
  2116.                     print("Press any key when ready...");
  2117.  
  2118.                     flush();
  2119.  
  2120.                     while( !inkey() )
  2121.                         ;
  2122.                 }
  2123.  
  2124.  
  2125.  
  2126.  
  2127.  
  2128.  
  2129.  
  2130.  
  2131.  
  2132.  
  2133.  
  2134.  
  2135.  
  2136.  
  2137.  
  2138.  
  2139.  
  2140.  
  2141.  
  2142.  
  2143.  
  2144.  
  2145.  
  2146.  
  2147.  
  2148.  
  2149.  
  2150.  
  2151.                                       36
  2152.  
  2153. ===============================================================================
  2154.  
  2155. PAUSE
  2156.  
  2157. ===============================================================================
  2158.  
  2159. Function        To suspend program operation until a key is pressed.
  2160.  
  2161. Syntax          void pause( void );
  2162.  
  2163. Prototype in    mfp.h
  2164.  
  2165.  
  2166.  
  2167. Remarks         Pause() waits until a keypress occurs before returning.
  2168.                 It flushes the keyboard buffer before waiting for a keypress.
  2169.  
  2170.  
  2171.  
  2172. EXAMPLE:
  2173.  
  2174.  
  2175.                 #include <stdio.h>
  2176.                 #include <mfp.h>
  2177.  
  2178.                 void main( void )
  2179.                 {
  2180.                     printf("Press any key to continue...");
  2181.  
  2182.                     pause();
  2183.                 }
  2184.  
  2185.  
  2186.  
  2187.  
  2188.  
  2189.  
  2190.  
  2191.  
  2192.  
  2193.  
  2194.  
  2195.  
  2196.  
  2197.  
  2198.  
  2199.  
  2200.  
  2201.  
  2202.  
  2203.  
  2204.  
  2205.  
  2206.  
  2207.  
  2208.  
  2209.  
  2210.  
  2211.  
  2212.                                       37
  2213.  
  2214. ===============================================================================
  2215.  
  2216. FAST
  2217.  
  2218. ===============================================================================
  2219.  
  2220. Function        Single line edit feature
  2221.  
  2222. Syntax          void fast( void )
  2223.  
  2224. Prototype in    mfp.h
  2225.  
  2226.  
  2227. Remarks         Allows editing of one user selected field from a supplied
  2228.                 list of fields.
  2229.  
  2230.                 Fast() is primarily designed to operate as a function key
  2231.                 procedure used in a MFP edit session. It is assigned a
  2232.                 function key within a PROC declaration.
  2233.  
  2234.                 A global edit list called "ed_list" must be intialized.
  2235.  
  2236.                 Fast() uses this "ed_list" to know the fields that can
  2237.                 be edited. Commonly the ed_list is made equal to the
  2238.                 mfp list that you pass to MFP. This allows fast() to
  2239.                 access all fields on the screen.
  2240.  
  2241.                 In some cases you may want certain fields excluded or
  2242.                 extra fields included. You should set up a seperate edit
  2243.                 list for these occasions.
  2244.  
  2245.                 The ed_list is defined in the MFP library. This means
  2246.                 you can make up several fast edit lists and before calling
  2247.                 mfp() you can make "ed_list" equal to that list.
  2248.  
  2249.                 In the example program described in the MFP section you
  2250.                 will notice the fast() function being assigned to function
  2251.                 key two. You should also notice that the "ed_list" is made
  2252.                 equal to the mfp list in line 49. This makes all fields
  2253.                 defined in that mfp list accessable to the fast() function.
  2254.  
  2255.                 Any function that uses the PROC list for function key
  2256.                 procedures may use fast() to allow field editing.
  2257.  
  2258.  
  2259.  
  2260.  
  2261.  
  2262.  
  2263.  
  2264.  
  2265.  
  2266.  
  2267.  
  2268.  
  2269.  
  2270.  
  2271.  
  2272.  
  2273.                                       38
  2274.  
  2275.  
  2276.  
  2277.  
  2278.  
  2279.  
  2280.  
  2281.  
  2282.  
  2283.  
  2284.  
  2285.  
  2286.  
  2287.  
  2288.  
  2289.  
  2290.  
  2291.  
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298.  
  2299.  
  2300.                            SCREEN OUTPUT FUNCTIONS
  2301.  
  2302. ===============================================================================
  2303.  
  2304. COLOR
  2305.  
  2306. ===============================================================================
  2307.  
  2308. Function        Color attribute of character data on screen.
  2309.  
  2310. Syntax          void color( int foreground, int background );
  2311.  
  2312. Prototype in    mfp.h
  2313.  
  2314. Remarks         Subsequent character display will have the color
  2315.                 attributes defined in the color statement. Can be
  2316.                 used for monochrome or color monitors.
  2317.  
  2318.  *** FOREGROUND ***                     *** OUTPUT ***
  2319. DEFINE        VALUE          COLOR MONITOR            MONOCHROME MONITOR                                         
  2320.  
  2321. REMOVE         -1            Disengage the color driver
  2322. BLACK           0            black foreground         black
  2323. BLUE            1            blue                     white w/ underline
  2324. GREEN           2            green                    white
  2325. CYAN            3            cyan                     white
  2326. RED             4            red                      white
  2327. MAGENTA         5            magenta                  white
  2328. BROWN           6            brown                    white
  2329. LIGHTGRAY       7            white                    white
  2330. DARKGRAY        8            gray                     black
  2331. LIGHTBLUE       9            bright blue              Bright white w/ underline
  2332. LIGHTGREEN     10              "    green               "    white 
  2333. LIGHTCYAN      11              "    cyan                "      "
  2334. LIGHTRED       12              "    red                 "      "
  2335. LIGHTMAGENTA   13              "    magenta             "      "
  2336. YELLOW         14              "    yellow              "      "
  2337. WHITE          15              "    white               "      "
  2338.             
  2339. BLINK      - Adding 16 to the above colors will cause blinking -
  2340.             
  2341.  *** BACKGROUND ***                    *** OUTPUT ***
  2342. DEFINE        VALUE          COLOR MONITOR        MONOCHROME MONITOR
  2343.                                                 
  2344. NONE           -1            Do not change the background color
  2345. BLACK           0            Black Backround      Black
  2346. BLUE            1            blue                   "
  2347. GREEN           2            green                  "
  2348. CYAN            3            cyan                   "
  2349. RED             4            red                    "
  2350. MAGENTA         5            magenta                "
  2351. BROWN           6            brown                  "
  2352. WHITE           7            white                White
  2353.  
  2354. NOTE:   With monochrome systems, a white background will always produce
  2355.         a black on white.
  2356.  
  2357. WARNING: If you are not using Turbo C, you MUST disengage the color driver
  2358.          by passing a (-1) as the foreground attribute before exiting to
  2359.          DOS. Failure to do so may cause a lock-up due to the video vector,
  2360.          (10H), being corrupt.
  2361.                                       40
  2362.  
  2363. ===============================================================================
  2364.  
  2365. CUP
  2366.  
  2367. ===============================================================================
  2368.  
  2369. Function        Cursor Positioning
  2370.  
  2371. Syntax          void cup( int row, int column );
  2372.  
  2373. Prototype in    mfp.h
  2374.  
  2375. Remarks         The cup() function allows you to position the cursor anywhere
  2376.                 on the screen. The row and column parameters begin at one and
  2377.                 end at 25 and 80 repectively.
  2378.  
  2379. EXAMPLE:
  2380.  
  2381.                 #include <stdio.h>
  2382.                 #include <mfp.h>
  2383.  
  2384.                 void main( void )
  2385.                 {
  2386.                     int row, col;
  2387.  
  2388.                     /*
  2389.                         Fill the screen with stars...
  2390.                     */
  2391.  
  2392.                     for( row = 1 ; row < 26 ; row++ )
  2393.                     {
  2394.                         for( col = 1 ; col < 81 ; col++ )
  2395.                         {
  2396.                             cup( row, col );
  2397.                             bioputc('*');
  2398.                         }
  2399.                     }
  2400.                 }
  2401.  
  2402.  
  2403.  
  2404.  
  2405.  
  2406.  
  2407.  
  2408.  
  2409.  
  2410.  
  2411.  
  2412.  
  2413.  
  2414.  
  2415.  
  2416.  
  2417.  
  2418.  
  2419.  
  2420.  
  2421.  
  2422.                                       41
  2423.  
  2424. ===============================================================================
  2425.  
  2426. GETCUP
  2427.  
  2428. ===============================================================================
  2429.  
  2430. Function        Get Cursor Position
  2431.  
  2432. Syntax          unsigned getcup( void );
  2433.  
  2434. Prototype in    mfp.h
  2435.  
  2436. Remarks         The getcup() function returns the cursor position on the
  2437.                 screen. The row is in the upper eight bits and the column
  2438.                 in the lower eight bits. Row and column ranges from 1 to 25
  2439.                 and 1 to 80 repectively.
  2440.  
  2441. EXAMPLE:
  2442.  
  2443.                 #include <stdio.h>
  2444.                 #include <mfp.h>
  2445.  
  2446.                 void main( void )
  2447.                 {
  2448.                     int row, col;
  2449.                     unsigned rowcol;
  2450.  
  2451.                     rowcol = getcup();
  2452.  
  2453.                     row = (rowcol >> 8) & 0xff;
  2454.                     col = rowcol & 0x0ff;
  2455.  
  2456.                     printf("Row %d, Col %d",row,col);
  2457.                 }
  2458.  
  2459.  
  2460.  
  2461.  
  2462.  
  2463.                                       42
  2464.  
  2465. ===============================================================================
  2466.  
  2467. PRINT
  2468.  
  2469. ===============================================================================
  2470.  
  2471. Function        High performance unformatted character string display.
  2472.  
  2473. Syntax          void print( char * );
  2474.  
  2475. Prototype in    mfp.h
  2476.  
  2477.  
  2478. Remarks         Displays to the console any character array or string.
  2479.  
  2480.  
  2481.  
  2482. EXAMPLE:
  2483.  
  2484.  
  2485.                 #include <stdio.h>
  2486.                 #include <mfp.h>
  2487.  
  2488.                 void main( void )
  2489.                 {
  2490.                     char *s = "Hello world!\n";
  2491.  
  2492.                     print("Hello world!\n");
  2493.  
  2494.                     print( s );
  2495.                 }
  2496.  
  2497.  
  2498.  
  2499.  
  2500.  
  2501.  
  2502.  
  2503.  
  2504.  
  2505.  
  2506.  
  2507.  
  2508.  
  2509.  
  2510.  
  2511.  
  2512.  
  2513.  
  2514.  
  2515.  
  2516.  
  2517.  
  2518.  
  2519.  
  2520.  
  2521.  
  2522.  
  2523.  
  2524.                                       43
  2525.  
  2526. ===============================================================================
  2527.  
  2528. SAY
  2529.  
  2530. ===============================================================================
  2531.  
  2532. Function        High performance unformatted character string display with
  2533.                 cursor coordinates.
  2534.  
  2535. Syntax          void say( int row, int col, char * );
  2536.  
  2537. Prototype in    mfp.h
  2538.  
  2539.  
  2540. Remarks         Displays to the console any character array or string at the
  2541.                 desired row and column. This function is a convenient method
  2542.                 of displaying string data. This function is a marraige of
  2543.                 cup and print.
  2544.  
  2545.  
  2546. EXAMPLE:
  2547.  
  2548.  
  2549.                 #include <stdio.h>
  2550.                 #include <mfp.h>
  2551.  
  2552.                 void main( void )
  2553.                 {
  2554.                     int r, c;
  2555.                     char *s = "Hello world!\n";
  2556.  
  2557.                     r = 10;
  2558.                     c = 15;
  2559.  
  2560.                     say( 10,15,"Hello world!\n" );
  2561.  
  2562.                     say( r,c,s );
  2563.                 }
  2564.  
  2565.  
  2566.  
  2567.  
  2568.  
  2569.  
  2570.  
  2571.  
  2572.  
  2573.  
  2574.  
  2575.  
  2576.  
  2577.  
  2578.  
  2579.  
  2580.  
  2581.  
  2582.  
  2583.  
  2584.  
  2585.                                       44
  2586.  
  2587. ===============================================================================
  2588.  
  2589. BIOPUTC
  2590.  
  2591. ===============================================================================
  2592.  
  2593. Function        High performance character display function.
  2594.  
  2595. Syntax          void bioputc( char c );
  2596.  
  2597. Prototype in    mfp.h
  2598.  
  2599. Remarks         For Lattice and Microsoft C users only.
  2600.  
  2601.                 The Lattice and Microsoft libraries do not provide a high
  2602.                 throughput character output function capable of providing
  2603.                 adequate performance for MFP's needs. The bioputc() function
  2604.                 is a putch() clone except it is twice as fast. This is because
  2605.                 control-break checking is not performed.
  2606.  
  2607.                 The bioptuc() function uses direct bios video services with
  2608.                 attribute support so color will work. The MFP library uses the
  2609.                 bioputc() function for all video output in the Lattice and
  2610.                 Microsoft versions.
  2611.  
  2612.                 TURBO C USERS: This function is not included in your library
  2613.                 because you don't need it. The Turbo C library is very opti-
  2614.                 mized and this function would only be redundant. The putch()
  2615.                 function performs the same.
  2616.  
  2617.  
  2618.  
  2619.  
  2620.  
  2621.  
  2622.  
  2623.  
  2624.  
  2625.  
  2626.  
  2627.  
  2628.  
  2629.  
  2630.  
  2631.  
  2632.  
  2633.  
  2634.  
  2635.  
  2636.  
  2637.  
  2638.  
  2639.  
  2640.  
  2641.  
  2642.  
  2643.  
  2644.  
  2645.  
  2646.                                       45
  2647.  
  2648. ===============================================================================
  2649.  
  2650. ESHOW
  2651.  
  2652. ===============================================================================
  2653.  
  2654. Function        Displays a defined mfp() entry screen.
  2655.  
  2656. Syntax          void eshow( MFP **mfp_list )
  2657.  
  2658. Prototype in    mfp.h
  2659.  
  2660.  
  2661. Remarks         The eshow() function displays the fields defined in
  2662.                 the passed mfp list parameter. This is handy if you
  2663.                 wish to display the field contents before allowing
  2664.                 an edit session.
  2665.  
  2666.                 The eshow() function requires the same type of MFP
  2667.                 list that the mfp() function uses.
  2668.  
  2669.  
  2670.  
  2671.  
  2672.  
  2673.  
  2674.  
  2675.  
  2676.  
  2677.  
  2678.  
  2679.  
  2680.  
  2681.  
  2682.  
  2683.  
  2684.  
  2685.  
  2686.  
  2687.  
  2688.  
  2689.  
  2690.  
  2691.  
  2692.  
  2693.  
  2694.  
  2695.  
  2696.  
  2697.  
  2698.  
  2699.  
  2700.  
  2701.  
  2702.  
  2703.  
  2704.  
  2705.  
  2706.  
  2707.                                       46
  2708.  
  2709.  
  2710.  
  2711.  
  2712.  
  2713.  
  2714.  
  2715.  
  2716.  
  2717.  
  2718.  
  2719.  
  2720.  
  2721.  
  2722.  
  2723.  
  2724.  
  2725.  
  2726.  
  2727.  
  2728.  
  2729.  
  2730.  
  2731.  
  2732.  
  2733.  
  2734.                             WINDOWING FUNCTIONS
  2735.  
  2736. ===============================================================================
  2737.  
  2738. WINDOW_CREATE
  2739.  
  2740. ===============================================================================
  2741.  
  2742. Function        Window creation
  2743.  
  2744. Syntax          WINDOW *window_create( unsigned ulr, unsigned ulc, 
  2745.                                        unsigned lrr, unsigned lrc );
  2746.  
  2747. Prototype in    mfp.h
  2748.  
  2749. Remarks           Window_create() allocates memory using malloc() and
  2750.                 copies the area defined in the parameter list to the
  2751.                 allocated memory. If enough memory is available the
  2752.                 function returns with a pointer to the window record.
  2753.  
  2754.                   If an error occurs allocating memory for the window the
  2755.                 function returns with a NULL value.
  2756.  
  2757.                   The pointer to the window record is unique for each
  2758.                 window and must be preserved until the window is killed.
  2759.  
  2760. CAUTION           Windows should be killed in the reverse order they were
  2761.                 created. This will insure your memory pool's integrity.
  2762.  
  2763.  
  2764. Example Usage:
  2765.  
  2766.  
  2767.             void errtypesel( unsigned r, unsigned c )
  2768.             {
  2769.                 static WINDOW *erbuf;
  2770.  
  2771.                 if( c > 40 )
  2772.                     c -= 20;
  2773.  
  2774.                 erbuf = window_create( r+5,c+10,r+10,c+29 );
  2775.                 color( YELLOW,MAGENTA );
  2776.                 wcls( r+5,c+10,r+10,c+29 );
  2777.                 box( r+5,c+10,r+10,c+29,0 );
  2778.                 color( LIGHTGREEN,MAGENTA );
  2779.                 cup( r+6,c+12 );
  2780.                 print("Disk type cannot");
  2781.                 cup( r+7,c+12 );
  2782.                 print("exceed master.");
  2783.                 cup( r+9,c+12 );
  2784.                 print("Press any key...");
  2785.                 bioputc(7);
  2786.                 pause();
  2787.                 window_kill( erbuf );
  2788.             }
  2789.  
  2790.  
  2791.  
  2792.  
  2793.  
  2794.  
  2795.                                       48
  2796.  
  2797. ===============================================================================
  2798.  
  2799. WINDOW_KILL
  2800.  
  2801. ===============================================================================
  2802.  
  2803. Function        Window removal
  2804.  
  2805. Syntax          void window_kill( WINDOW *winrec ); 
  2806.  
  2807. Prototype in    mfp.h
  2808.  
  2809. Remarks           Window_kill() copies the screen data saved during
  2810.                 the window_create() back to the screen. It also
  2811.                 deallocates the memory used to store the screen data
  2812.                 and the window record.
  2813.  
  2814. CAUTION           Windows should be killed in the reverse order they were
  2815.                 created. This will insure your memory pool's integrity.
  2816.  
  2817.  
  2818. Example Usage:
  2819.  
  2820.  
  2821.             void errtypesel( unsigned r, unsigned c )
  2822.             {
  2823.                 static WINDOW *erbuf;
  2824.  
  2825.                 if( c > 40 )
  2826.                     c -= 20;
  2827.  
  2828.                 erbuf = window_create( r+5,c+10,r+10,c+29 );
  2829.                 color( YELLOW,MAGENTA );
  2830.                 wcls( r+5,c+10,r+10,c+29 );
  2831.                 box( r+5,c+10,r+10,c+29,0 );
  2832.                 color( LIGHTGREEN,MAGENTA );
  2833.                 cup( r+6,c+12 );
  2834.                 print("Disk type cannot");
  2835.                 cup( r+7,c+12 );
  2836.                 print("exceed master.");
  2837.                 cup( r+9,c+12 );
  2838.                 print("Press any key...");
  2839.                 bioputc(7);
  2840.                 pause();
  2841.                 window_kill( erbuf );
  2842.             }
  2843.  
  2844.  
  2845.  
  2846.  
  2847.  
  2848.  
  2849.  
  2850.  
  2851.  
  2852.  
  2853.  
  2854.  
  2855.  
  2856.                                       49
  2857.  
  2858. ===============================================================================
  2859.  
  2860. WCLS
  2861.  
  2862. ===============================================================================
  2863.  
  2864. Function        Clear an area of the screen.
  2865.  
  2866. Syntax          void wcls(int u_l_row,int u_l_col, int l_r_row, int l_r_col);
  2867.  
  2868. Prototype in    mfp.h
  2869.  
  2870.  
  2871. Remarks         Clear an area defined by the upper left and lower right
  2872.                 corners. Handy for simple windows or clearing screen
  2873.                 sections.
  2874.  
  2875.  
  2876. EXAMPLE:
  2877.  
  2878.  
  2879.                 void main( void )
  2880.                 {
  2881.                     /*
  2882.                         Clear a box at row 5 column 15 to row 10 column 30.
  2883.                     */
  2884.  
  2885.                     wcls( 5, 15, 10, 30 );
  2886.                 }
  2887.  
  2888.  
  2889.  
  2890.  
  2891.  
  2892.  
  2893.  
  2894.  
  2895.  
  2896.  
  2897.  
  2898.  
  2899.  
  2900.  
  2901.  
  2902.  
  2903.  
  2904.  
  2905.  
  2906.  
  2907.  
  2908.  
  2909.  
  2910.  
  2911.  
  2912.  
  2913.  
  2914.  
  2915.  
  2916.  
  2917.                                       50
  2918.  
  2919. ===============================================================================
  2920.  
  2921. BOX
  2922.  
  2923. ===============================================================================
  2924.  
  2925. Function        Draw a rectangular box
  2926.  
  2927. Syntax          void box( int ulr, int ulc, int lrr, int lrc, int type );
  2928.  
  2929. Prototype in    mfp.h
  2930.  
  2931. Remarks         Outlines a box using the extended ASCII box drawing characters
  2932.                 at the coordinates supplied.
  2933.  
  2934.                 You must pass box() the upper left row, upper left column,
  2935.                 lower right row, lower right column, and the box type.
  2936.  
  2937.                 The box() function will outline four box types:
  2938.  
  2939.                     0   --  Single lines horizontal and vertical.
  2940.                     1   --  Double lines horizontal and vertical.
  2941.                     2   --  Double lines horizontal and single lines vertical.
  2942.                     3   --  Single lines horizontal and double lines vertical.
  2943.  
  2944. EXAMPLE:
  2945.  
  2946.                 #include <stdio.h>
  2947.                 #include <mfp.h>
  2948.  
  2949.                 #define SCREEN  0
  2950.                 #define BUFFER  !SCREEN
  2951.  
  2952.                 void message( char *s )
  2953.                 {
  2954.                     int len, c;
  2955.                     char *buf;
  2956.                     len = strlen( s ) + 4;
  2957.                     buf = (char *)malloc( (len + 1) * 12 );
  2958.                     if( buf != NULL )
  2959.                     {
  2960.                         c = (80 - len)/2                /* Center box     */
  2961.                         W_SWAP( 10, c, 15, c + len, SCREEN, buf );
  2962.                         color( BLACK, WHITE );
  2963.                         wcls( 10, c, 15, c + len );     /* Clear the area  */
  2964.                         box( 10, c, 15, c + len, 1 );   /* Double line box */
  2965.                         cup( 13, c + 2 );
  2966.                         print( s );                     /* Display message */
  2967.                         pause();    
  2968.                         W_SWAP( 10, c, 15, c + len, BUFFER, buf );
  2969.                         free( buf );
  2970.                     }
  2971.                 }
  2972.  
  2973.  
  2974.  
  2975.  
  2976.  
  2977.  
  2978.                                       51
  2979.  
  2980. ===============================================================================
  2981.  
  2982. W_SWAP
  2983.  
  2984. ===============================================================================
  2985.  
  2986. Function        Swap an area on the screen with memory and visa-versa.
  2987.  
  2988. Syntax          void w_swap( int ulr, int ulc, int lrr,
  2989.                              int lrc, int mode, char *buffer );
  2990.  
  2991. Prototype in    mfp.h
  2992.  
  2993. Remarks         The w_swap() function requires the upper left row, upper left
  2994.                 column, lower right row, lower right column of the screen
  2995.                 area to be dealt with, the operational mode, and the buffer
  2996.                 to store or retrieve the screen data.
  2997.  
  2998.                 The mode parameter is zero for writing the screen to buffer
  2999.                 and is non-zero to write the buffer to screen.
  3000.  
  3001.                 The buffer MUST be large enough to accomodate the screen
  3002.                 area being operated on. You can calculate the minimum buffer
  3003.                 size using the following formula; 
  3004.  
  3005.                 (((lrc - ulc) + 1) * ((lrr - ulr) + 1)) * 2 = min buffer size.
  3006.  
  3007.  
  3008.  
  3009.  
  3010.  
  3011.  
  3012.  
  3013.  
  3014.  
  3015.  
  3016.  
  3017.  
  3018.  
  3019.  
  3020.  
  3021.  
  3022.  
  3023.  
  3024.  
  3025.  
  3026.  
  3027.  
  3028.  
  3029.  
  3030.  
  3031.  
  3032.  
  3033.  
  3034.  
  3035.  
  3036.  
  3037.  
  3038.  
  3039.                                       52
  3040.  
  3041. ===============================================================================
  3042.  
  3043. SCRSWP
  3044.  
  3045. ===============================================================================
  3046.  
  3047. Function        Screen Swap
  3048.  
  3049. Syntax          void scrswp( char *buffer, int mode );
  3050.  
  3051. Prototype in    mfp.h
  3052.  
  3053.  
  3054. Remarks         Allows you to copy the screen's contents to a buffer or
  3055.                 copy a buffer's contents to the screen. The mode integer
  3056.                 determines which way the copy will go.
  3057.  
  3058.                 If mode is non-zero, it will copy the buffer contents
  3059.                 to the screen.
  3060.  
  3061.                 If mode is zero, it will copy the screen contents to the
  3062.                 buffer.
  3063.  
  3064.                 The buffer must be at least 4000 bytes in size. Any smaller
  3065.                 and data after the buffer will get wiped out.
  3066.  
  3067.  
  3068. EXAMPLE:
  3069.  
  3070.  
  3071.                 #define SCREEN  0
  3072.                 #define BUFFER  !SCREEN
  3073.  
  3074.                 void main( void )
  3075.                 {
  3076.                     char buf[ 4000 ];
  3077.  
  3078.                     scrswp( buf, SCREEN );  /* save the current screen */
  3079.  
  3080.                     .
  3081.                     .
  3082.                     .
  3083.  
  3084.                     scrswp( buf, BUFFER );  /* restore the screen */
  3085.                 } 
  3086.  
  3087.  
  3088.  
  3089.  
  3090.  
  3091.  
  3092.  
  3093.  
  3094.  
  3095.  
  3096.  
  3097.  
  3098.  
  3099.  
  3100.                                       53
  3101.  
  3102.  
  3103.  
  3104.  
  3105.  
  3106.  
  3107.  
  3108.  
  3109.  
  3110.  
  3111.  
  3112.  
  3113.  
  3114.  
  3115.  
  3116.  
  3117.  
  3118.  
  3119.  
  3120.  
  3121.  
  3122.  
  3123.  
  3124.  
  3125.  
  3126.  
  3127.                            DATE AND TIME FUNCTIONS
  3128.  
  3129. ===============================================================================
  3130.  
  3131. DATE
  3132.  
  3133. ===============================================================================
  3134.  
  3135. Function        Provide a character date of "MM/DD/YY"
  3136.  
  3137. Syntax          char *date( char *d_buf )
  3138.  
  3139. Prototype in    mfp.h
  3140.  
  3141. Remarks         Requires a nine character array and returns with a
  3142.                 pointer to the passed array initialized with the current
  3143.                 date provided by the operating system.
  3144.  
  3145.                 The date is provided in the month/day/year format.
  3146.  
  3147.                 The Lattice C version requires the LCR.LIB file to be
  3148.                 linked because of the call to the intdos() function.
  3149.  
  3150. EXAMPLE:
  3151.  
  3152.  
  3153.                 #include <stdio.h>
  3154.                 #include <mfp.h>
  3155.  
  3156.                 void main( void )
  3157.                 {
  3158.                     char date_buf[ 9 ];
  3159.  
  3160.                     printf("The current date is %s", date( date_buf ) );
  3161.                 }
  3162.  
  3163. NOTE:       Microsoft C and Quick C users, this function is not provided
  3164.             because the _strdate() function provides the same function
  3165.  
  3166.  
  3167.  
  3168.  
  3169.  
  3170.  
  3171.  
  3172.  
  3173.  
  3174.  
  3175.  
  3176.  
  3177.  
  3178.  
  3179.  
  3180.  
  3181.  
  3182.  
  3183.  
  3184.  
  3185.  
  3186.  
  3187.  
  3188.                                       55
  3189.  
  3190. ===============================================================================
  3191.  
  3192. LDATE
  3193.  
  3194. ===============================================================================
  3195.  
  3196. Function        Provide a character date of "MM/DD/YYYY"
  3197.  
  3198. Syntax          char *ldate( char *d_buf )
  3199.  
  3200. Prototype in    mfp.h
  3201.  
  3202. Remarks         Requires an eleven character array and returns with a
  3203.                 pointer to the passed array initialized with the current
  3204.                 date provided by the operating system.
  3205.  
  3206.                 The date is provided in the month/day/year format.
  3207.  
  3208.                 The difference between date() and ldate() is that ldate()
  3209.                 returns with the full four character year.
  3210.  
  3211.                 The Lattice C version requires the LCR.LIB file to be
  3212.                 linked because of the call to the intdos() function.
  3213.  
  3214.  
  3215. EXAMPLE:
  3216.  
  3217.  
  3218.                 #include <stdio.h>
  3219.                 #include <mfp.h>
  3220.  
  3221.                 void main( void )
  3222.                 {
  3223.                     char date_buf[ 11 ];
  3224.  
  3225.                     printf("The current date is %s", ldate( date_buf ) );
  3226.                 }
  3227.  
  3228.  
  3229.  
  3230.  
  3231.  
  3232.  
  3233.  
  3234.  
  3235.  
  3236.  
  3237.  
  3238.  
  3239.  
  3240.  
  3241.  
  3242.  
  3243.  
  3244.  
  3245.  
  3246.  
  3247.  
  3248.  
  3249.                                       56
  3250.  
  3251. ===============================================================================
  3252.  
  3253. STR_JUL
  3254.  
  3255. ===============================================================================
  3256.  
  3257. Function        Conversion from date character to date numeric.
  3258.  
  3259. Syntax          long str_jul( char *date_buf )
  3260.  
  3261. Prototype in    mfp.h
  3262.  
  3263. Remarks         Str_jul() provides an excellent method of converting a
  3264.                 date string to a numeric value. The numeric value can
  3265.                 be used for date mathematics or for database storage and
  3266.                 sorting.
  3267.  
  3268.                 Str_jul() requires the date string passed to be ten
  3269.                 characters, in a "MM/DD/YYYY" format. The ldate() function
  3270.                 provides a string in this format.
  3271.  
  3272.                 Str_jul can accept input dates ranging from "01/01/0001" to
  3273.                 "01/30/3055" inclusive.
  3274.  
  3275.  
  3276. EXAMPLE:
  3277.  
  3278.                 #include <stdio.h>
  3279.                 #include <mfp.h>
  3280.  
  3281.                 void main( void )
  3282.                 {
  3283.                     char date_buf[ 11 ];
  3284.                     long now, then;
  3285.  
  3286.                     printf("The current date is %s", ldate(date_buf));
  3287.  
  3288.                     now = str_jul( date_buf );
  3289.  
  3290.                     then = now + 180;
  3291.  
  3292.                     printf("180 days from now is %s", jul_str(then,date_buf));
  3293.                 }
  3294.  
  3295.  
  3296.  
  3297.  
  3298.  
  3299.  
  3300.  
  3301.  
  3302.  
  3303.  
  3304.  
  3305.  
  3306.  
  3307.  
  3308.  
  3309.  
  3310.                                       57
  3311.  
  3312. ===============================================================================
  3313.  
  3314. JUL_STR
  3315.  
  3316. ===============================================================================
  3317.  
  3318. Function        Conversion from date numeric to date character.
  3319.  
  3320. Syntax          char *jul_str( long date_num, char *date_buf )
  3321.  
  3322. Prototype in    mfp.h
  3323.  
  3324. Remarks         Jul_str() provides an execellent method of converting a
  3325.                 date numeric back to a string.
  3326.  
  3327.                 The jul_str function returns a pointer to the date string
  3328.                 passed.
  3329.  
  3330.                 The input limitations for the numeric date are 1 to
  3331.                 1,115,503 for output dates ranging from "01/01/0001" to
  3332.                 "01/30/3055" respectively.
  3333.  
  3334.                 The date string passed must be a minimum of eleven characters.
  3335.  
  3336.  
  3337. EXAMPLE:
  3338.  
  3339.                 #include <stdio.h>
  3340.                 #include <mfp.h>
  3341.  
  3342.                 void main( void )
  3343.                 {
  3344.                     char date_buf[ 11 ];
  3345.                     long now, then;
  3346.  
  3347.                     printf("The current date is %s", ldate(date_buf));
  3348.  
  3349.                     now = str_jul( date_buf );
  3350.  
  3351.                     then = now + 180;
  3352.  
  3353.                     printf("180 days from now is %s", jul_str(then,date_buf));
  3354.                 }
  3355.  
  3356.  
  3357.  
  3358.  
  3359.  
  3360.  
  3361.  
  3362.  
  3363.  
  3364.  
  3365.  
  3366.  
  3367.  
  3368.  
  3369.  
  3370.  
  3371.                                       58
  3372.  
  3373. ===============================================================================
  3374.  
  3375. CAL_JUL
  3376.  
  3377. ===============================================================================
  3378.  
  3379. Function        Provides a date numeric based upon the the date parameters
  3380.                 provided.
  3381.  
  3382. Syntax          long cal_jul( int month, int day, int year )
  3383.  
  3384. Prototype in    mfp.h
  3385.  
  3386. Remarks         Requires three integers representing the month, day, and
  3387.                 year. It returns a long integer representing the number of
  3388.                 days from 01/01/0001.
  3389.  
  3390.  
  3391. EXAMPLE:
  3392.  
  3393.                 #include <mfp.h>
  3394.  
  3395.                 long str_jul( char *date )
  3396.                 {
  3397.                     int m, d, y;
  3398.                     char sub[ 5 ];
  3399.  
  3400.                     m = d = y = 0;
  3401.  
  3402.                     zero( sub,5 );
  3403.  
  3404.                     sub[ 0 ] = date[ 0 ];
  3405.                     sub[ 1 ] = date[ 1 ];
  3406.  
  3407.                     sscanf( sub, "%d", &m );
  3408.  
  3409.                     sub[ 0 ] = date[ 3 ];
  3410.                     sub[ 1 ] = date[ 4 ];
  3411.  
  3412.                     sscanf( sub, "%d", &d );
  3413.  
  3414.                     sub[ 0 ] = date[ 6 ];
  3415.                     sub[ 1 ] = date[ 7 ];
  3416.                     sub[ 2 ] = date[ 8 ];
  3417.                     sub[ 3 ] = date[ 9 ];
  3418.  
  3419.                     sscanf( sub, "%d", &y );
  3420.  
  3421.                     return( cal_jul( m, d, y ) );
  3422.                 }
  3423.  
  3424.  
  3425.  
  3426.  
  3427.  
  3428.  
  3429.  
  3430.  
  3431.  
  3432.                                       59
  3433.  
  3434. ===============================================================================
  3435.  
  3436. JUL_CAL
  3437.  
  3438. ===============================================================================
  3439.  
  3440. Function        Converts a date numeric to either a day, month, or year
  3441.                 integer.
  3442.  
  3443. Syntax          int jul_cal( long date_num, char *item )
  3444.  
  3445. Prototype in    mfp.h
  3446.  
  3447. Remarks         This function allows selective conversion from the date
  3448.                 numeric to an integer representation of the day or month
  3449.                 or the year.
  3450.  
  3451.                 The selection of what is to be returned is determined by
  3452.                 the second item parameter. If an "M" or "m" is passed the
  3453.                 month will be returned. If a "D" or "d" is passed the day
  3454.                 will be returned. If a "Y" or "y" is passed the year will
  3455.                 be returned.
  3456.  
  3457.  
  3458. EXAMPLE:
  3459.  
  3460.                 #include <mfp.h>
  3461.  
  3462.                 char *jul_str( long julian, char *date )
  3463.                 {
  3464.                     int m, d, y;
  3465.  
  3466.                     m = jul_cal( julian, "M" );
  3467.                     d = jul_cal( julian, "D" );
  3468.                     y = jul_cal( julian, "Y" );
  3469.  
  3470.                     sprintf( date, "%02d/%02d/%04d", m, d, y );
  3471.  
  3472.                     return( date );
  3473.                 }
  3474.  
  3475.  
  3476.  
  3477.  
  3478.  
  3479.  
  3480.  
  3481.  
  3482.  
  3483.  
  3484.  
  3485.  
  3486.  
  3487.  
  3488.  
  3489.  
  3490.  
  3491.  
  3492.  
  3493.                                       60
  3494.  
  3495. ===============================================================================
  3496.  
  3497. STRTIME
  3498.  
  3499. ===============================================================================
  3500.  
  3501. Function        Provides the time from DOS in "HH:MM:SS" format.
  3502.  
  3503. Syntax          char *strtime( char *time_buf )
  3504.  
  3505. Prototype in    mfp.h
  3506.  
  3507. Remarks         Requires a nine character buffer, the ninth character
  3508.                 reserved for a terminating NULL.
  3509.  
  3510.                 Returns a character pointer to the time character buffer.
  3511.  
  3512.                 The Lattice C version requires the LCR.LIB file to be
  3513.                 linked because of the call to the intdos() function.
  3514.  
  3515. EXAMPLE:
  3516.  
  3517.  
  3518.                 #include <mfp.h>
  3519.  
  3520.                 void show_time( void )
  3521.                 {
  3522.                     char tbuf[ 9 ];
  3523.  
  3524.                     cup( 1,70 );
  3525.                     print( strtime( tbuf ) );
  3526.                 }
  3527.  
  3528. NOTE:       Microsoft C and Quick C users, this function is not provided
  3529.             because the _strtime() function provides the same function.
  3530.  
  3531.  
  3532.  
  3533.  
  3534.  
  3535.  
  3536.  
  3537.  
  3538.  
  3539.  
  3540.  
  3541.  
  3542.  
  3543.  
  3544.  
  3545.  
  3546.  
  3547.  
  3548.  
  3549.  
  3550.  
  3551.  
  3552.  
  3553.  
  3554.                                       61
  3555.  
  3556. ===============================================================================
  3557.  
  3558. TIME_NUM
  3559.  
  3560. ===============================================================================
  3561.  
  3562. Function        Provides a numeric representation of a time character string.
  3563.  
  3564. Syntax          long time_num( char *time_buf )
  3565.  
  3566. Prototype in    mfp.h
  3567.  
  3568. Remarks         Time_num() requires an eight character array representing the
  3569.                 time in the format, "HH:MM:SS".
  3570.  
  3571.                 Time_num() returns a long integer value that represents the
  3572.                 number of seconds elapsed since midnite of the time character
  3573.                 array parameter.
  3574.  
  3575.                 If time_num() is passed "00:30:00" as a parameter it would
  3576.                 return 1800.
  3577.  
  3578. EXAMPLE:
  3579.  
  3580.  
  3581.                 #include <mfp.h>
  3582.  
  3583.                 long time_test( char *time_1, char *time_2 )
  3584.                 {
  3585.                     return( time_num( time_1 ) - time_num( time_2 ) );
  3586.                 }
  3587.  
  3588.  
  3589.  
  3590.  
  3591.  
  3592.  
  3593.  
  3594.  
  3595.  
  3596.  
  3597.  
  3598.  
  3599.  
  3600.  
  3601.  
  3602.  
  3603.  
  3604.  
  3605.  
  3606.  
  3607.  
  3608.  
  3609.  
  3610.  
  3611.  
  3612.  
  3613.  
  3614.  
  3615.                                       62
  3616.  
  3617.  
  3618.  
  3619.  
  3620.  
  3621.  
  3622.  
  3623.  
  3624.  
  3625.  
  3626.  
  3627.  
  3628.  
  3629.  
  3630.  
  3631.  
  3632.  
  3633.  
  3634.  
  3635.  
  3636.  
  3637.  
  3638.  
  3639.  
  3640.  
  3641.  
  3642.                            DATA BUFFER FUNCTIONS
  3643.  
  3644. ===============================================================================
  3645.  
  3646. ZERO
  3647.  
  3648. ===============================================================================
  3649.  
  3650. Function        Fills a character array with NUL's.
  3651.  
  3652. Syntax          void zero( char *array, int array_length );
  3653.  
  3654. Prototype in    mfp.h
  3655.  
  3656.  
  3657. Remarks         Handy function to initialize a buffer before or after use.
  3658.  
  3659.                 Be careful with the length parameter - if it's too long,
  3660.                 it may wipe out other data because you will make it initial-
  3661.                 ize data after the array.
  3662.  
  3663.  
  3664. EXAMPLE:
  3665.  
  3666.  
  3667.                 void main( void )
  3668.                 {
  3669.                     char buf[ 80 ];
  3670.  
  3671.                     do
  3672.                     {
  3673.                         zero( buf, 80 );
  3674.  
  3675.                         gets( buf );
  3676.  
  3677.                         printf("%s\n",buf);
  3678.                     }
  3679.                     while( buf[ 0 ] );
  3680.                 }
  3681.  
  3682.  
  3683.  
  3684.  
  3685.  
  3686.  
  3687.  
  3688.  
  3689.  
  3690.  
  3691.  
  3692.  
  3693.  
  3694.  
  3695.  
  3696.  
  3697.  
  3698.  
  3699.  
  3700.  
  3701.  
  3702.  
  3703.                                       64
  3704.  
  3705. ===============================================================================
  3706.  
  3707. FILL
  3708.  
  3709. ===============================================================================
  3710.  
  3711. Function        Initialize a block of data with a specific character.
  3712.  
  3713. Syntax          void fill( char *block, int length, char character );
  3714.  
  3715. Prototype in    mfp.h
  3716.  
  3717. Remarks         The fill() function requires the pointer to the block of data
  3718.                 to be initialized, the length of the block, and the character
  3719.                 to initialize it with.
  3720.  
  3721.                 Be careful with the length parameter. It can damage your
  3722.                 code if it overruns the data you wanted to initialize.
  3723.  
  3724. EXAMPLE:
  3725.  
  3726.  
  3727.                 void main( void )
  3728.                 {
  3729.                     char buf[ 80 ];
  3730.  
  3731.                     do
  3732.                     {
  3733.                         fill( buf, 80, 'A' );
  3734.  
  3735.                         printf("%s\n",buf);
  3736.                     }
  3737.                     while( buf[ 0 ] );
  3738.                 }
  3739.  
  3740.  
  3741.  
  3742.  
  3743.  
  3744.  
  3745.  
  3746.  
  3747.  
  3748.  
  3749.  
  3750.  
  3751.  
  3752.  
  3753.  
  3754.  
  3755.  
  3756.  
  3757.  
  3758.  
  3759.  
  3760.  
  3761.  
  3762.  
  3763.  
  3764.                                       65
  3765.  
  3766. ===============================================================================
  3767.  
  3768. CRC & CRC32
  3769.  
  3770. ===============================================================================
  3771.  
  3772. Function        Provide a 16 or 32 bit Cyclic Rendundancy Check of a block of
  3773.                 data. Useful for error checking of any I/O process moving a
  3774.                 block of data.
  3775.  
  3776. Syntax          unsigned int crc( char *block, int length );
  3777.                 unsigned long crc32( char *block, int length );
  3778.  
  3779. Prototype in    mfp.h
  3780.  
  3781. Remarks         Both crc() and crc32() scan a block of data and perform an
  3782.                 algorythm using the data as input to a polynomial equation.
  3783.  
  3784.                 The result of the polynomial is the "crc". This value can
  3785.                 be used to validate the accuracy of a data block if the "crc"
  3786.                 was transmitted along with the data block. It can also be
  3787.                 used to check if a data record is corrupt. The 32 bit crc
  3788.                 generated by crc32() is more thorough and provides better
  3789.                 accuracy than it's 16 bit cousin, crc(). This is mainly due
  3790.                 to the size of the resultant polynomial.
  3791.  
  3792. EXAMPLE:
  3793.  
  3794.                 #include <stdio.h>
  3795.                 #include <mfp.h>
  3796.  
  3797.                 unsigned int block_ck( char *block, int len, unsigned int crc )
  3798.                 {
  3799.                     /*
  3800.                         Compare the passed crc with the current crc
  3801.                         of the data block.
  3802.                     */
  3803.                     return( crc( block,len ) - crc );
  3804.                 }
  3805.  
  3806.  
  3807.  
  3808.  
  3809.  
  3810.  
  3811.  
  3812.  
  3813.  
  3814.  
  3815.  
  3816.  
  3817.  
  3818.  
  3819.  
  3820.  
  3821.  
  3822.  
  3823.  
  3824.  
  3825.                                       66
  3826.  
  3827.  
  3828.  
  3829.  
  3830.  
  3831.  
  3832.  
  3833.  
  3834.  
  3835.  
  3836.  
  3837.  
  3838.  
  3839.  
  3840.  
  3841.  
  3842.  
  3843.  
  3844.  
  3845.  
  3846.  
  3847.  
  3848.  
  3849.  
  3850.  
  3851.  
  3852.                            MISCELLANEUOS FUNCTIONS
  3853.  
  3854. ===============================================================================
  3855.  
  3856. BRKOFF & BRKON
  3857.  
  3858. ===============================================================================
  3859.  
  3860. Function        To disable or reenable the break key
  3861.  
  3862. Syntax          void brkoff( void )
  3863.                 void brkon( void )
  3864.  
  3865. Prototype in    mfp.h
  3866.  
  3867. Remarks         These functions allow you to turn off the break or ctrl C
  3868.                 keys thereby avoiding possible disaster if the users attempted
  3869.                 to "break" out, leaving the machine in an undefined state or
  3870.                 vectors pointing to nowhere.
  3871.  
  3872.                 The brkoff() function is called first to disable the break key.
  3873.  
  3874.                 The brkoff() function works by intercepting the hardware
  3875.                 keyboard interrupt and checking the scan codes coming from
  3876.                 the keyboard. If it senses a key sequence that would activate
  3877.                 the DOS control break routines, this function would "bit-bin"
  3878.                 the keystroke as though it never occurred.
  3879.  
  3880.                 The brkon() function turns the break key on again.
  3881.  
  3882.                 The brkon() function disengages the brkoff() function by
  3883.                 removing its chain into the keyboard interrupt. THIS FUNCTION
  3884.                 MUST BE CALLED PRIOR TO RETURNING TO DOS IF BRKOFF() IS USED.
  3885.  
  3886.                 If you neglect to call brkon() the keyboard will cease to func-
  3887.                 tion, requiring you to cold boot the computer.
  3888.  
  3889.                 The brkoff() and brkon() functions use interrupt vector 9.
  3890.  
  3891.                 WARNING: This function intercepts interrupt vectors that may
  3892.                 ======== be used by other functions in this library. This makes
  3893.                          it very important that you disengage this function in
  3894.                          the reverse order it was engaged in. This will insure
  3895.                          the integrity of the interrupt vectors upon return to
  3896.                          DOS. EXAMPLE:
  3897.                                         brkoff();   /* Turn off break key   */
  3898.                                         scrsave();  /* Screen saver         */
  3899.                                         showclok(); /* Real time clock      */
  3900.                                             .
  3901.                                             .
  3902.                                         noclok();   /* Disengage clock      */
  3903.                                         nosave();   /* Disengage scrn saver */
  3904.                                         brkon();    /* Turn break key on    */
  3905.  
  3906.  
  3907.  
  3908.  
  3909.  
  3910.  
  3911.  
  3912.  
  3913.                                       68
  3914.  
  3915. ===============================================================================
  3916.  
  3917. SCRSAVE & NOSAVE
  3918.  
  3919. ===============================================================================
  3920.  
  3921. Function        Turns display off after time period of no keyboard activity.
  3922.  
  3923. Syntax          void scrsave( int tenths );
  3924.                 void nosave( void );
  3925.  
  3926. Prototype in    mfp.h
  3927.  
  3928. Remarks         The scrsave() function requires an integer value representing
  3929.                 the time in tenths of a second, to wait before blanking the
  3930.                 display. The purpose for this function is to increase the
  3931.                 amount of time before your main menu makes a permanent im-
  3932.                 pression on the phosphors of the users monitor. It accomplishes
  3933.                 this task by waiting the required time after each keypress
  3934.                 until the time expires. It then stores the attribute bytes in
  3935.                 screen memory to a 2k buffer and then writes out a BLACK on
  3936.                 BLACK attribute in the originals place. This makes the screen
  3937.                 look like it has been turned off and it effectively will pre-
  3938.                 vent screen burn. When a subsequent keypress occurs, this func-
  3939.                 tion will write the stored attributes back out into screen
  3940.                 memory effectively restoring the original screen.
  3941.  
  3942.                 The nosave() function is used to disengage the scrsave()
  3943.                 function. THIS FUNCTION MUST BE CALLED PRIOR TO RETURNING TO
  3944.                 DOS IF scrsave() IS USED.
  3945.  
  3946.                 The scrsave() function intercepts interrupt vectors 9 and 1CH.
  3947.  
  3948.                 WARNING: This function intercepts interrupt vectors that may
  3949.                 ======== be used by other functions in this library. This makes
  3950.                          it very important that you disengage this function in
  3951.                          the reverse order it was engaged in. This will insure
  3952.                          the integrity of the interrupt vectors upon return to
  3953.                          DOS. EXAMPLE:
  3954.                                         brkoff();   /* Turn off break key   */
  3955.                                         scrsave();  /* Screen saver         */
  3956.                                         showclok(); /* Real time clock      */
  3957.                                             .
  3958.                                             .
  3959.                                         noclok();   /* Disengage clock      */
  3960.                                         nosave();   /* Disengage scrn saver */
  3961.                                         brkon();    /* Turn break key on    */
  3962.  
  3963.  
  3964.  
  3965.  
  3966.  
  3967.  
  3968.  
  3969.  
  3970.  
  3971.  
  3972.  
  3973.  
  3974.                                       69
  3975.  
  3976. ===============================================================================
  3977.  
  3978. SHOWCLOK & NOCLOK
  3979.  
  3980. ===============================================================================
  3981.  
  3982. Function        Displays the current time on the screen every second.
  3983.  
  3984. Syntax          void showclok( int row, int col, int fg, int bg );
  3985.                 void noclok( void );
  3986.  
  3987. Prototype in    mfp.h
  3988.  
  3989. Remarks         The showclok() function requires the row, column, foreground
  3990.                 attribute, and background attribute. It will display the
  3991.                 time continuously until you disengage it. It is a background
  3992.                 task that will not interfere or measurably affect your app-
  3993.                 lication. It provides a nice eight character digital presen-
  3994.                 tation, HH:MM:SS.
  3995.  
  3996.                 The noclok() function is used to disengage the showclok()
  3997.                 function. THIS FUNCTION MUST BE CALLED PRIOR TO RETURNING TO
  3998.                 DOS IF showclok() IS USED.
  3999.  
  4000.                 The showclok() function intercepts interrupt vector 1CH.
  4001.  
  4002.                 WARNING: This function intercepts interrupt vectors that may
  4003.                 ======== be used by other functions in this library. This makes
  4004.                          it very important that you disengage this function in
  4005.                          the reverse order in which it was engaged. This will
  4006.                          insure the integrity of the interrupt vectors upon
  4007.                          return to DOS.
  4008.                                 EXAMPLE:
  4009.                                         brkoff();   /* Turn off break key   */
  4010.                                         scrsave();  /* Screen saver         */
  4011.                                         showclok(); /* Real time clock      */
  4012.                                             .
  4013.                                             .
  4014.                                         noclok();   /* Disengage clock      */
  4015.                                         nosave();   /* Disengage scrn saver */
  4016.                                         brkon();    /* Turn break key on    */
  4017.  
  4018.  
  4019.  
  4020.  
  4021.  
  4022.  
  4023.  
  4024.  
  4025.  
  4026.  
  4027.  
  4028.  
  4029.  
  4030.  
  4031.  
  4032.  
  4033.  
  4034.  
  4035.                                       70
  4036.  
  4037. ===============================================================================
  4038.  
  4039. DELAY
  4040.  
  4041. ===============================================================================
  4042.  
  4043. Function        Delay for a period of time
  4044.  
  4045. Syntax          void delay( unsigned clicks );
  4046.  
  4047. Prototype in    mfp.h
  4048.  
  4049. Remarks         The delay function provides an exact delay in 55 millisecond
  4050.                 increments. The delay function uses the internal clock timer
  4051.                 to establish its operation. The unsigned parameter is the
  4052.                 number of 55 millisecond clock ticks to wait. The clock
  4053.                 ticks at a rate of 18.2 ticks per second. A typical 1/2
  4054.                 second delay would pass a parameter value of nine.
  4055.  
  4056. EXAMPLE
  4057.  
  4058.  
  4059.                 #include <stdio.h>
  4060.                 #include <mfp.h>
  4061.  
  4062.                 void main( void )
  4063.                 {
  4064.                     unsigned ticks;
  4065.  
  4066.                     printf("Please standby, waiting 10 seconds...");
  4067.  
  4068.                     ticks = 182;
  4069.  
  4070.                     delay( ticks );
  4071.  
  4072.                     printf("\n\nThankyou for your patience.");
  4073.                 }
  4074.  
  4075.  
  4076.  
  4077.  
  4078.  
  4079.  
  4080.  
  4081.  
  4082.  
  4083.  
  4084.  
  4085.  
  4086.  
  4087.  
  4088.  
  4089.  
  4090.  
  4091.  
  4092.  
  4093.  
  4094.  
  4095.  
  4096.                                       71
  4097.  
  4098.  
  4099.          ----------------end-of-author's-documentation---------------
  4100.  
  4101.                         Software Library Information:
  4102.  
  4103.                    This disk copy provided as a service of
  4104.  
  4105.                         The Public (Software) Library
  4106.  
  4107.          We are not the authors of this program, nor are we associated
  4108.          with the author in any way other than as a distributor of the
  4109.          program in accordance with the author's terms of distribution.
  4110.  
  4111.          Please direct shareware payments and specific questions about
  4112.          this program to the author of the program, whose name appears
  4113.          elsewhere in  this documentation. If you have trouble getting
  4114.          in touch with the author,  we will do whatever we can to help
  4115.          you with your questions. All programs have been tested and do
  4116.          run.  To report problems,  please use the form that is in the
  4117.          file PROBLEM.DOC on many of our disks or in other written for-
  4118.          mat with screen printouts, if possible.  The P(s)L cannot de-
  4119.          bug programs over the telephone.
  4120.  
  4121.          Disks in the P(s)L are updated monthly, so if you did not get
  4122.          this disk  directly from the P(s)L,  you should be aware that
  4123.          the files in this set may no  longer be the current versions.
  4124.  
  4125.          For a copy of the latest monthly software library newsletter
  4126.          and a list of the 2,000+ disks in the library, call or write
  4127.  
  4128.                         The Public (Software) Library
  4129.                               P.O.Box 35705
  4130.                            Houston, TX 77235-5705
  4131.                                (713) 524-6394
  4132.  
  4133.